@@ -2,7 +2,7 @@ import { expect } from '@esm-bundle/chai';
22import { fixtureSync } from '@vaadin/testing-helpers' ;
33import '../src/vaadin-overlay.js' ;
44import { html , PolymerElement } from '@polymer/polymer/polymer-element.js' ;
5- import { isElementFocused } from '@vaadin/a11y-base/src/focus-utils.js' ;
5+ import { getDeepActiveElement } from '@vaadin/a11y-base/src/focus-utils.js' ;
66import { close , open } from './helpers.js' ;
77
88customElements . define (
@@ -66,7 +66,7 @@ describe('restore focus', () => {
6666 focusInput . focus ( ) ;
6767 await open ( overlay ) ;
6868 await close ( overlay ) ;
69- expect ( isElementFocused ( focusInput ) ) . to . be . false ;
69+ expect ( getDeepActiveElement ( ) ) . to . not . equal ( focusInput ) ;
7070 } ) ;
7171
7272 it ( 'should not restore focus-ring attribute on close by default' , async ( ) => {
@@ -87,7 +87,7 @@ describe('restore focus', () => {
8787 focusInput . focus ( ) ;
8888 await open ( overlay ) ;
8989 await close ( overlay ) ;
90- expect ( isElementFocused ( focusInput ) ) . to . be . false ;
90+ expect ( getDeepActiveElement ( ) ) . to . not . equal ( focusInput ) ;
9191 } ) ;
9292
9393 it ( 'should not restore focus-ring attribute on close by default' , async ( ) => {
@@ -119,7 +119,7 @@ describe('restore focus', () => {
119119 focusInput . focus ( ) ;
120120 await open ( overlay ) ;
121121 await close ( overlay ) ;
122- expect ( isElementFocused ( focusInput ) ) . to . be . true ;
122+ expect ( getDeepActiveElement ( ) ) . to . equal ( focusInput ) ;
123123 } ) ;
124124
125125 it ( 'should restore focus-ring attribute on close' , async ( ) => {
@@ -142,15 +142,15 @@ describe('restore focus', () => {
142142 focusable . focus ( ) ;
143143 await open ( overlay ) ;
144144 await close ( overlay ) ;
145- expect ( isElementFocused ( focusable ) ) . to . be . true ;
145+ expect ( getDeepActiveElement ( ) ) . to . equal ( focusable ) ;
146146 } ) ;
147147
148148 it ( 'should restore focus on close if focus was moved to body' , async ( ) => {
149149 focusInput . focus ( ) ;
150150 await open ( overlay ) ;
151151 overlay . blur ( ) ;
152152 await close ( overlay ) ;
153- expect ( isElementFocused ( focusInput ) ) . to . be . true ;
153+ expect ( getDeepActiveElement ( ) ) . to . equal ( focusInput ) ;
154154 } ) ;
155155
156156 it ( 'should restore focus-ring attribute on close if focus was moved to body' , async ( ) => {
@@ -168,7 +168,7 @@ describe('restore focus', () => {
168168 await open ( overlay ) ;
169169 focusable . focus ( ) ;
170170 await close ( overlay ) ;
171- expect ( isElementFocused ( focusable ) ) . to . be . true ;
171+ expect ( getDeepActiveElement ( ) ) . to . equal ( focusable ) ;
172172 } ) ;
173173
174174 it ( 'should not restore focus-ring attribute if focus was moved outside overlay' , async ( ) => {
@@ -190,7 +190,7 @@ describe('restore focus', () => {
190190 focusable . focus ( ) ;
191191 await open ( overlay ) ;
192192 await close ( overlay ) ;
193- expect ( isElementFocused ( focusInput ) ) . to . be . true ;
193+ expect ( getDeepActiveElement ( ) ) . to . equal ( focusInput ) ;
194194 } ) ;
195195
196196 it ( 'should restore focus-ring attribute on the restoreFocusNode' , async ( ) => {
0 commit comments