File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1017,17 +1017,20 @@ export class Paginator extends HTMLElement {
10171017 . find ( r => r . width > 0 && r . height > 0 ) || rects [ 0 ]
10181018 if ( ! rect ) return
10191019 await this . #scrollToRect( rect , reason )
1020- let node = anchor . focus ? anchor : undefined
1021- if ( ! node && anchor . startContainer ) {
1022- node = anchor . startContainer
1023- if ( node . nodeType === Node . TEXT_NODE ) {
1024- node = node . parentElement
1020+ // focus the element when navigating with keyboard or screen reader
1021+ if ( reason === 'navigation' ) {
1022+ let node = anchor . focus ? anchor : undefined
1023+ if ( ! node && anchor . startContainer ) {
1024+ node = anchor . startContainer
1025+ if ( node . nodeType === Node . TEXT_NODE ) {
1026+ node = node . parentElement
1027+ }
1028+ }
1029+ if ( node && node . focus ) {
1030+ node . tabIndex = - 1
1031+ node . style . outline = 'none'
1032+ node . focus ( { preventScroll : true } )
10251033 }
1026- }
1027- if ( node && node . focus ) {
1028- node . tabIndex = - 1
1029- node . style . outline = 'none'
1030- node . focus ( { preventScroll : true } )
10311034 }
10321035 return
10331036 }
You can’t perform that action at this time.
0 commit comments