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 : After selecting year/month datepicker getting closed in IOS #85

Closed

Conversation

akshat-angelone057
Copy link

@akshat-angelone057 akshat-angelone057 commented Feb 24, 2024

In IOS select tag looses focus, since its default behaviour of IOS safari to focus out from select tag once the option is selected.

so here we focus on wrapper div of select tag, this makes wrapper div as the related target in the onFocusOut event, and visible still remains true

@akshat-angelone057
Copy link
Author

@probablykasper please have a look at this PR

@probablykasper probablykasper linked an issue Feb 26, 2024 that may be closed by this pull request
Copy link
Owner

@probablykasper probablykasper left a comment

Choose a reason for hiding this comment

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

This messes with the focus behavior:

Screen.Recording.2024-02-26.at.16.02.15.mov

@akshat-angelone057
Copy link
Author

@probablykasper fixed please check now

@probablykasper
Copy link
Owner

probablykasper commented Feb 26, 2024

The issue is that the <select>'s outline is gone and that it breaks keyboard accessibility. I think this also is an issue for screen readers if <select> isn't focused

@akshat-angelone057
Copy link
Author

The issue is that the <select>'s outline is gone and that it breaks keyboard accessibility. I think this also is an issue for screen readers if <select> isn't focused

got your point let me work on it

@probablykasper
Copy link
Owner

imo it should be looked into if there's a decent way to keep the <select> focused

@akshat-angelone057
Copy link
Author

@probablykasper so i did bit of research like what can be the done to keep select focus but it seems there is no proper way to do it other than using setTimeout.
seems relatedTarget being null is not yet solved in safari Mobile (earlier it was there in firefox too)- facebook/react#2011

there are ways to get relatedTarget but we will have to give tabIndex = "0" to wrapper divs of select tags

can we handle this case specific to iphone and ipad so that existing a11y remain unaffected? because anyways a11y seems broken in the case of iphone and ipad as datepicker itself is closing after selecting month/year

@probablykasper
Copy link
Owner

Yes it can be iOS-specific

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.

iPhone closeOnSelection triggered by month and year dropdown
2 participants