Expand description
DropZone — a “drop files here” target for external (OS) drag-and-drop.
A bordered, tinted region that accepts files / text / URLs dragged in from the operating system (Finder, Explorer, Nautilus) or another application. It reacts to hover (accept / reject highlight) and fires typed callbacks on drop. Because an OS drag cannot be initiated from the keyboard, the zone also offers a keyboard-operable Browse… button (opening the native file dialog) as the WCAG 2.1.1 equivalent.
DropZone::new(tr!("drop_images_here"))
.subtitle(tr!("png_or_jpeg"))
.accept_extensions(["png", "jpg", "jpeg"])
.allow_multiple(true)
.on_files_dropped(|paths, _ctx| { /* import paths */ });External drops are delivered through the framework’s normal drag pipeline
(on_drag_hover / on_drag_leave / on_drop) once
install_external_dnd is wired and a backend
is available; on platforms with no backend (e.g. X11) the Browse button
keeps the zone fully usable.
§Styling
The bordered, tinted chrome is a Tier-3 [DropZoneStyle]; the default
RecipeDropZoneStyle tracks the
interaction state. Override per-call with DropZone::style or theme-wide
via theme.style_slots.drop_zone.
§Accessibility
The zone is a Role::Group labelled by its prompt, with a Live::Polite
status line that announces hover (“Drop to add 3 files”), success
(“3 files added”), and rejection. AccessKit models no drag/drop action and
ARIA’s aria-grabbed / aria-dropeffect are deprecated, so live-region
announcements plus the Browse fallback are the supported pattern.
Structs§
- Drop
Zone - A drop target for external (OS) drag-and-drop. See the module docs.