8000 fix: improve modal focus by HarshMN2345 · Pull Request #2049 · appwrite/console · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: improve modal focus #2049

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

Merged
merged 9 commits into from
Jun 30, 2025

Conversation

HarshMN2345
Copy link
Contributor

What does this PR do?

Implements a dual focus strategy for modals using both autofocus attribute and onMount focus handling. This ensures reliable input focus across different scenarios (initial load and dynamic content) and improves keyboard accessibility.

Test Plan

  1. Initial page load:

    • Open any modal with input field
    • Verify first input is focused automatically
  2. Dynamic content:

    • Open modals through user interactions
    • Verify input focus works when modal opens
    • Test with keyboard navigation
  3. Browser testing:

    • Tested on Chrome, Firefox, Safari
    • Verified no double-focus effects occur

Related PRs and Issues

Fixes #1882 - Modal focus not working consistently

Have you read the Contributing Guidelines on issues?

Yes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets try to avoid onMount() hooks along with document.querySelector. Its gets very messy to maintain and isn't a good DX as well. See if the autofocus on the Input components itself work. If they don't we might need to raise a PR on Pink2 side.

Copy link
Contributor Author

Hey @ItzNotABug,
Noticed that autofocus isn’t working as expected in components like Feedback, Evaluate, and Create Organization — turns out Pink2’s Input doesn’t forward the prop properly. We could rely on onMount for now as a workaround in places where initial focus is important, though it's a bit messy. Ideally, Pink2 should support native autofocus, and once that's fixed, we can drop the manual focus handling.

@HarshMN2345 HarshMN2345 changed the title fix: improve modal focus with dual autofocus strategy fix: improve modal focus Jun 27, 2025
@HarshMN2345 HarshMN2345 requested a review from ItzNotABug June 30, 2025 06:17
@HarshMN2345 HarshMN2345 requested a review from ItzNotABug June 30, 2025 07:40
@@ -269,7 +269,9 @@
>Feedback
</Button.Button>
<svelte:fragment slot="other">
<MobileFeedbackModal />
{#if $isSmallViewport}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both these feedback and support sections are for mobile only right? instead of only using the small view port check on feedback, lets move the check on an upper level.

Comment on lines 334 to 336
{#if $isSmallViewport}
<MobileFeedbackModal />
{/if}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above if the mobile only section applies here.

@HarshMN2345 HarshMN2345 requested a review from ItzNotABug June 30, 2025 08:56
@ItzNotABug ItzNotABug merged commit d217a05 into appwrite:main Jun 30, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0