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

ngbAutofocus not working with Bootstrap 5.2.1 #4418

Open
bastienmoulia opened this issue Nov 14, 2022 · 2 comments
Open

ngbAutofocus not working with Bootstrap 5.2.1 #4418

bastienmoulia opened this issue Nov 14, 2022 · 2 comments

Comments

@bastienmoulia
Copy link
Contributor

Bug description:

With the change of Bootstrap 5.2.1 (twbs/bootstrap#37026) :focus was replaced by :focus-visible. Since then ngbAutofocus is not working.

Link to minimally-working StackBlitz that reproduces the issue:

https://stackblitz.com/edit/angular-jxqgtu?file=src/index.html

Versions of Angular, ng-bootstrap and Bootstrap:

Angular: 14.2.10

ng-bootstrap: 13.1.0

Bootstrap: 5.2.1

@bastienmoulia
Copy link
Contributor Author

There is an experimental option for .focus() called focusVisible. But it's only for Firefox for now:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#focus_on_a_button
https://caniuse.com/mdn-api_htmlelement_focus_options_focusvisible_parameter

@maxokorokov
Copy link
Member

maxokorokov commented Nov 23, 2022

I'm not sure what we could do on our side at the moment... It's the way Bootstrap decides to display focus and as you say there is no way to force focus to be visible. If you open the modal with the keyboard, focus is shown fine, if you open with the mouse it is not.

On the other hand it works differently for the X button, that is focused consistently...

We could update the demo detailing the behaviour.

It is also the same for the datepicker inside the popup and the dropdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants