Skip to content
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

Fix offcanvas menu open bug #1116

Merged
merged 3 commits into from
Nov 9, 2024
Merged

Conversation

lhsazevedo
Copy link
Contributor

@lhsazevedo lhsazevedo commented Nov 8, 2024

Add the click handler to the backdrop element instead of the document to close the offcanvas menu on mobile devices.

Fixes #1112, fixes #1118

Add the click handler to the backdrop element instead of the document to
close the offcanvas menu on mobile devices.

Fixes php#1112
Copy link
Contributor

github-actions bot commented Nov 8, 2024

🚀 Regression report for commit 4c23310 is at https://web-php-regression-report-pr-1116.preview.thephp.foundation

Copy link
Contributor

github-actions bot commented Nov 8, 2024

🚀 Preview for commit 4c23310 can be found at https://web-php-pr-1116.preview.thephp.foundation

@sy-records
Copy link
Member

It's displaying properly, but there's a small problem:

The close button is selected by default after displaying

Sets the initial focus on the first navigation item instead of the close
button when opening the offcanvas nav. Improves accessibility and user
experience for keyboard and screen reader users.

Closes php#1118
Copy link
Member

@sy-records sy-records left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you!

js/common.js Outdated
}
};
}
Copy link
Member

Choose a reason for hiding this comment

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

Should this semicolon be retained?

Suggested change
}
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! Some other lines were also missing semicolons, so I just ran this navbar section through Prettier again.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should employ a linter?

Copy link
Member

@saundefined saundefined left a comment

Choose a reason for hiding this comment

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

Thanks!
Linter is a great proposal, I guess we can add it in a separate PR

@saundefined saundefined merged commit 8413b22 into php:master Nov 9, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Offcanvas nav opens with focus on close button instead of nav links Fix navbar offcanvas menu bug
4 participants