-
Notifications
You must be signed in to change notification settings - Fork 4k
Fix workspace keyboard focus not returning to 3-dot trigger after Back #97171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Krishna2323
wants to merge
11
commits into
Expensify:main
Choose a base branch
from
Krishna2323:krishna2323/issue/96971
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
2f6cf38
Fix workspace keyboard focus not returning to 3-dot trigger after Back
Krishna2323 8160c2f
Fix focus return to Overview Name/Description rows after Back
Krishna2323 b25fd3c
Add ThreeDotsMenu unit tests for deferred focus restore handshake
Krishna2323 f6e34ed
Fix FocusTrapForModalTest unsafe type assertions for lint seatbelt
Krishna2323 bc52a32
Prefer registered ThreeDots launcher over nested menu focus
Krishna2323 3934675
Only reuse stack launcher when focus is already inside the trap
Krishna2323 cff4130
Use display:contents host for FocusTrap launcher container
Krishna2323 716191e
Skip ThreeDots anchor restore on Safari immediate selection path
Krishna2323 e89efd9
Restore More-button focus after ButtonWithDropdownMenu navigation
Krishna2323 f2a933a
Add BaseModal coverage for modal-hide callback ordering
Krishna2323 cfdbf44
Merge branch 'Expensify:main' into krishna2323/issue/96971
Krishna2323 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| /** | ||
| * Chooses which element FocusTrapForModal should register as the launcher on activate. | ||
| * Pure so nested-trap vs new-modal cases can be unit-tested without the focus-trap harness. | ||
| */ | ||
| function resolveFocusTrapLauncher(fromActive: HTMLElement | null, activeStacked: HTMLElement | null, container: HTMLElement | null, fallback: HTMLElement | null): HTMLElement | null { | ||
| // Parent trap already moved focus into this container (PopoverMenu Modal → content). | ||
| // Keep the registered outside opener — do not capture the ephemeral in-menu node. | ||
| // A newly opened nested modal still uses fromActive when the opener is outside this container. | ||
| const focusAlreadyInsideTrap = !!fromActive && !!container?.contains(fromActive); | ||
| if (focusAlreadyInsideTrap && activeStacked && fromActive !== activeStacked) { | ||
| return activeStacked; | ||
| } | ||
| return fromActive ?? fallback; | ||
| } | ||
|
|
||
| export default resolveFocusTrapLauncher; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ import HeaderWithBackButton from '@components/HeaderWithBackButton'; | |
| import ScreenWrapper from '@components/ScreenWrapper'; | ||
| import TextInput from '@components/TextInput'; | ||
|
|
||
| import useAutoFocusInput from '@hooks/useAutoFocusInput'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
|
|
||
|
|
@@ -30,6 +31,7 @@ type Props = WithPolicyProps; | |
| function WorkspaceNamePage({policy}: Props) { | ||
| const styles = useThemeStyles(); | ||
| const {translate} = useLocalize(); | ||
| const {inputCallbackRef} = useAutoFocusInput(); | ||
|
|
||
| const submit = useCallback( | ||
| (values: FormOnyxValues<typeof ONYXKEYS.FORMS.WORKSPACE_SETTINGS_FORM>) => { | ||
|
|
@@ -97,7 +99,7 @@ function WorkspaceNamePage({policy}: Props) { | |
| accessibilityLabel={translate('workspace.common.workspaceName')} | ||
| defaultValue={policy?.name} | ||
| spellCheck={false} | ||
| autoFocus | ||
| ref={inputCallbackRef} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't fix the root cause. |
||
| /> | ||
| </View> | ||
| </FormProvider> | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.