From 34b8ea3f06b9d4aca1f0e23179bc5a2509c07b2a Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Mon, 17 Aug 2026 22:17:22 -0700 Subject: [PATCH] fix(dashboard): keep the on-screen keyboard down when the share sheet opens MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Autofocusing the recipient input popped the keyboard over the bottom sheet the moment it opened, hiding the access list before the user had chosen what to do — the same reason the revoke flow already focuses the dialog instead of the input. On touch-primary devices give the dialog container initial focus (which also anchors the Tab trap); desktop keeps the input autofocus. --- src/gui/src/UI/Dashboard/UIShareModal.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gui/src/UI/Dashboard/UIShareModal.js b/src/gui/src/UI/Dashboard/UIShareModal.js index de8594b98..b0b09f719 100644 --- a/src/gui/src/UI/Dashboard/UIShareModal.js +++ b/src/gui/src/UI/Dashboard/UIShareModal.js @@ -22,6 +22,7 @@ import item_icon from '../../helpers/item_icon.js'; import { owner_of_path } from '../../helpers/path_owner.js'; import { invalidate_shared_roots } from '../../helpers/shared_access.js'; import { icons } from '../../helpers/actionIcons.js'; +import { isTouchPrimaryDevice } from './ContextMenu/ContextMenu.js'; const { html_encode } = window; @@ -137,9 +138,16 @@ export default function UIShareModal ({ path: item_path, name, owner, fsentry, $ const $submit = $overlay.find('.share-modal-submit'); // Focus returns to wherever the user was (usually the shared row) when - // the modal closes; the input takes it while the modal is up. + // the modal closes. While it's up, the recipient input takes it on + // desktop; on touch-primary devices the dialog itself does, because + // focusing the input would pop the on-screen keyboard over the sheet + // before the user has chosen what to do (add, change, or revoke). const el_previous_focus = document.activeElement; - $recipient.get(0)?.focus({ preventScroll: true }); + if ( isTouchPrimaryDevice() ) { + $overlay.find('.share-modal').get(0)?.focus({ preventScroll: true }); + } else { + $recipient.get(0)?.focus({ preventScroll: true }); + } let closed = false; const close = () => {