File tree 2 files changed +13
-3
lines changed
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 529
529
dialogPolyfill . DialogManager . prototype . handleFocus_ = function ( event ) {
530
530
if ( this . containedByTopDialog_ ( event . target ) ) { return ; }
531
531
532
+ if ( document . activeElement === document . documentElement ) { return ; }
533
+
532
534
event . preventDefault ( ) ;
533
535
event . stopPropagation ( ) ;
534
536
safeBlur ( /** @type {Element } */ ( event . target ) ) ;
539
541
var dialog = dpi . dialog ;
540
542
var position = dialog . compareDocumentPosition ( event . target ) ;
541
543
if ( position & Node . DOCUMENT_POSITION_PRECEDING ) {
542
- if ( this . forwardTab_ ) { // forward
544
+ if ( this . forwardTab_ ) {
545
+ // forward
543
546
dpi . focus_ ( ) ;
544
- } else { // backwards
547
+ } else if ( event . target !== document . documentElement ) {
548
+ // backwards if we're not already focused on <html>
545
549
document . documentElement . focus ( ) ;
546
550
}
547
551
} else {
Original file line number Diff line number Diff line change 1
1
<!DOCTYPE html>
2
- < html >
2
+ < html tabindex =" 0 " >
3
3
< meta charset ='utf-8 '>
4
4
< head >
5
5
< script src ="../dialog-polyfill.js "> </ script >
6
6
< meta name ="viewport " content ="width=device-width, user-scalable=no ">
7
7
< link rel ="stylesheet " type ="text/css " href ="../dialog-polyfill.css ">
8
8
< style >
9
+ html {
10
+ border : 4px solid white;
11
+ }
12
+ html : focus {
13
+ border-color : red;
14
+ }
9
15
dialog {
10
16
width : 100px ;
11
17
}
You can’t perform that action at this time.
0 commit comments