diff --git a/README.md b/README.md
index a690c99..334c423 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,7 @@ A clean, cloud-synced web app for cataloguing your physical storage boxes and th
- **Box & Item Catalog** - Create boxes with a name, location, description, tags and photos, and add items to them
- **Photos** - Attach several photos to any box or item, taken with the in-app camera or picked from the gallery; open them fullscreen with pinch and double-tap zoom
+- **No Accidental Duplicates** - While you type the name of a new box or item, existing ones with a similar name (typos included) are listed under the field; tap one to open it instead of creating it again
- **Box Locations** - Record where each box physically is ("attic, shelf 2"); earlier locations are offered as you type
- **Fuzzy Search** - Find items by name, description or tag, powered by [Fuse.js](https://www.fusejs.io/). Searching the box list also looks at locations and inside the boxes, and says which item matched
- **Tagging System** - Boxes and items share one tag vocabulary; rename, merge or delete a tag everywhere from a central manager
@@ -75,6 +76,12 @@ over it.
3. Give it a name and, optionally, a location, a description, tags and photos.
4. Open the box and tap **+** again to start cataloguing its contents.
+While you type a name, boxes or items you already have with a similar name are
+listed under the field. Tap one (or reach it with the arrow keys and press
+Enter) to open it instead: a box opens, an item opens in its edit form, where it
+can be moved to another box. The list is only a reminder; **Create Box** and
+**Add Item** still create a new one.
+
### Navigating
| View | How to reach it |
diff --git a/src/App.jsx b/src/App.jsx
index e51bf2e..7a2aab5 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -2127,6 +2127,8 @@ function App() {
askConfirm={askConfirm}
knownLocations={knownLocations}
availableTags={tagSuggestions}
+ boxes={boxes}
+ onOpenExisting={handleBoxClick}
/>
diff --git a/src/components/AddBoxModal.jsx b/src/components/AddBoxModal.jsx
index 29ab1c6..f66831e 100644
--- a/src/components/AddBoxModal.jsx
+++ b/src/components/AddBoxModal.jsx
@@ -9,9 +9,10 @@ import { usePhotoCapture } from '../native/usePhotoCapture';
import { useTranslation } from '../translations';
import { LocationInput } from './LocationInput';
import { TagInput } from './TagInput';
+import { NameInputWithMatches } from './NameInputWithMatches';
import { parseTagInput } from '../utils/tagUtils';
-export function AddBoxModal({ isOpen, onClose, onAdd, askConfirm, knownLocations = [], availableTags = [] }) {
+export function AddBoxModal({ isOpen, onClose, onAdd, askConfirm, knownLocations = [], availableTags = [], boxes = [], onOpenExisting }) {
const { t } = useTranslation();
const [name, setName] = useState('');
const [description, setDescription] = useState('');
@@ -46,6 +47,13 @@ export function AddBoxModal({ isOpen, onClose, onAdd, askConfirm, knownLocations
if (typeof onClose === 'function') onClose();
};
+ // The box being described already exists: open it instead of making a
+ // second one.
+ const handleOpenExisting = (box) => {
+ handleClose();
+ if (typeof onOpenExisting === 'function') onOpenExisting(box);
+ };
+
const handleFileChange = async (e) => {
// Capture the firing input up front so we can reset it after the await
// (works for both the camera and the gallery input).
@@ -115,17 +123,23 @@ export function AddBoxModal({ isOpen, onClose, onAdd, askConfirm, knownLocations
return (