Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Render alternative names inside the item name input instead of below it (#2287)

Leendert de Borst77f1bc824a37
diff --git a/apps/browser-extension/src/assets/tailwind.css b/apps/browser-extension/src/assets/tailwind.css
index ac68d2e2d..66028b948 100644
--- a/apps/browser-extension/src/assets/tailwind.css
+++ b/apps/browser-extension/src/assets/tailwind.css
@@ -2,6 +2,18 @@
@tailwind components;
@tailwind utilities;
+@layer utilities {
+ /* Horizontally scrollable rows without a visible scrollbar taking up space. */
+ .no-scrollbar {
+ -ms-overflow-style: none;
+ scrollbar-width: none;
+ }
+
+ .no-scrollbar::-webkit-scrollbar {
+ display: none;
+ }
+}
+
@media (max-width: 380px) {
html, body {
width: 350px;
diff --git a/apps/browser-extension/src/entrypoints/popup/components/Items/ItemNameInput.tsx b/apps/browser-extension/src/entrypoints/popup/components/Items/ItemNameInput.tsx
index 5cda632e3..6848a4df1 100644
--- a/apps/browser-extension/src/entrypoints/popup/components/Items/ItemNameInput.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/components/Items/ItemNameInput.tsx
@@ -17,6 +17,7 @@ type ItemNameInputProps = {
folders: Folder[];
selectedFolderId: string | null | undefined;
onFolderChange: (folderId: string | null) => void;
+ suggestions?: string[];
};
/**
@@ -29,7 +30,8 @@ const ItemNameInput: React.FC<ItemNameInputProps> = ({
onChange,
folders,
selectedFolderId,
- onFolderChange
+ onFolderChange,
+ suggestions = []
}) => {
const { t } = useTranslation();
const [showFolderModal, setShowFolderModal] = useState(false);
@@ -174,9 +176,28 @@ const ItemNameInput: React.FC<ItemNameInputProps> = ({
return (
<>
<div>
- <label htmlFor="itemName" className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">
- {t('items.itemName')} <span className="text-red-500">*</span>
- </label>
+ {/* mb-1.5 rather than mb-1: the suggestion pills fill the whole line box, so they sit closer to the input than bare label text would */}
+ <div className="flex items-center gap-2 mb-1.5">
+ <label htmlFor="itemName" className="shrink-0 block text-sm font-medium text-gray-700 dark:text-gray-300">
+ {t('items.itemName')} <span className="text-red-500">*</span>
+ </label>
+ {/* Name suggestions, inline with the label so they don't add an extra row */}
+ {suggestions.length > 0 && (
+ <div className="flex-1 min-w-0 flex items-center gap-1 overflow-x-auto no-scrollbar" aria-label={t('items.suggestions')}>
+ {suggestions.map(name => (
+ <button
+ key={name}
+ type="button"
+ onClick={() => onChange(name)}
+ title={`${t('items.suggestions')}: ${name}`}
+ className="shrink-0 max-w-[7rem] truncate px-2 py-0.5 text-xs rounded-full bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300 hover:bg-primary-100 dark:hover:bg-primary-900/40 hover:text-primary-700 dark:hover:text-primary-300 transition-colors"
+ >
+ {name}
+ </button>
+ ))}
+ </div>
+ )}
+ </div>
<div className="relative flex items-center">
<input
ref={inputRef}
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/items/ItemAddEdit.tsx b/apps/browser-extension/src/entrypoints/popup/pages/items/ItemAddEdit.tsx
index 7ce6915a8..e08ffe0b9 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/items/ItemAddEdit.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/items/ItemAddEdit.tsx
@@ -1382,29 +1382,8 @@ const ItemAddEdit: React.FC = () => {
folders={folders}
selectedFolderId={item.FolderId}
onFolderChange={(folderId) => setItem({ ...item, FolderId: folderId })}
+ suggestions={isEditMode ? [] : suggestedNames.filter(name => name && name !== item.Name).slice(0, 3)}
/>
- {/* Alternative item title suggestions (create mode) */}
- {!isEditMode && ((): React.ReactNode => {
- const nameSuggestions = suggestedNames.filter(name => name && name !== item.Name).slice(0, 3);
- if (nameSuggestions.length === 0) {
- return null;
- }
- return (
- <div className="mt-2 flex flex-wrap items-center gap-1.5">
- <span className="text-xs text-gray-500 dark:text-gray-400">{t('items.suggestions')}:</span>
- {nameSuggestions.map(name => (
- <button
- key={name}
- type="button"
- onClick={() => setItem(prev => prev ? { ...prev, Name: name } : prev)}
- className="px-2 py-0.5 text-xs rounded-full bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-200 hover:bg-primary-100 dark:hover:bg-primary-900/40 hover:text-primary-700 dark:hover:text-primary-300 transition-colors"
- >
- {name}
- </button>
- ))}
- </div>
- );
- })()}
{/* Primary fields (like URL) shown below name */}
{primaryFields.map(field => (
<div key={field.FieldKey}>