File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -50,16 +50,15 @@ function getElAndScroll() {
50
50
// update focus to where the page is scrolled to
51
51
// unfortunately this doesn't work in safari (desktop and iOS) when blur() is called
52
52
let originalTabIndex = element . getAttribute ( 'tabindex' ) ;
53
- if ( originalTabIndex === null ) element . setAttribute ( 'tabindex' , - 1 ) ;
53
+ if ( originalTabIndex === null && ! isInteractiveElement ( element ) ) {
54
+ element . setAttribute ( 'tabindex' , - 1 ) ;
55
+ }
54
56
element . focus ( { preventScroll : true } ) ;
55
- if ( originalTabIndex === null ) {
56
- if ( ! isInteractiveElement ( element ) ) {
57
- // for some reason calling blur() in safari resets the focus region to where it was previously,
58
- // if blur() is not called it works in safari, but then are stuck with default focus styles
59
- // on an element that otherwise might never had focus styles applied, so not an option
60
- element . blur ( ) ;
61
- }
62
-
57
+ if ( originalTabIndex === null && ! isInteractiveElement ( element ) ) {
58
+ // for some reason calling blur() in safari resets the focus region to where it was previously,
59
+ // if blur() is not called it works in safari, but then are stuck with default focus styles
60
+ // on an element that otherwise might never had focus styles applied, so not an option
61
+ element . blur ( ) ;
63
62
element . removeAttribute ( 'tabindex' ) ;
64
63
}
65
64
You can’t perform that action at this time.
0 commit comments