@@ -376,6 +376,68 @@ describe("Comment", () => {
376376 } ) ;
377377 } ) ;
378378
379+ describe ( "Focused element after editing in reading mode" , ( ) => {
380+ let pages ;
381+
382+ beforeEach ( async ( ) => {
383+ pages = await loadAndWait (
384+ "comments.pdf" ,
385+ ".annotationLayer" ,
386+ "page-width" ,
387+ null ,
388+ { enableComment : true }
389+ ) ;
390+ } ) ;
391+
392+ afterEach ( async ( ) => {
393+ await closePages ( pages ) ;
394+ } ) ;
395+
396+ it ( "must check that the focus is moved on the comment button" , async ( ) => {
397+ await Promise . all (
398+ pages . map ( async ( [ browserName , page ] ) => {
399+ const commentButtonSelector = `[data-annotation-id="612R"] + button.annotationCommentButton` ;
400+ await waitAndClick ( page , commentButtonSelector ) ;
401+ const commentPopupSelector = "#commentPopup" ;
402+ const editButtonSelector = `${ commentPopupSelector } button.commentPopupEdit` ;
403+ await waitAndClick ( page , editButtonSelector ) ;
404+
405+ await page . waitForSelector ( "#commentManagerCancelButton" , {
406+ visible : true ,
407+ } ) ;
408+ let handle = await createPromise ( page , resolve => {
409+ document
410+ . querySelector (
411+ `[data-annotation-id="612R"] + button.annotationCommentButton`
412+ )
413+ . addEventListener ( "focus" , resolve , { once : true } ) ;
414+ } ) ;
415+ await page . click ( "#commentManagerCancelButton" ) ;
416+ await awaitPromise ( handle ) ;
417+
418+ await waitAndClick ( page , commentButtonSelector ) ;
419+ await waitAndClick ( page , editButtonSelector ) ;
420+
421+ const textInputSelector = "#commentManagerTextInput" ;
422+ await page . waitForSelector ( textInputSelector , {
423+ visible : true ,
424+ } ) ;
425+ await page . type ( textInputSelector , "Hello world!" ) ;
426+
427+ handle = await createPromise ( page , resolve => {
428+ document
429+ . querySelector (
430+ `[data-annotation-id="612R"] + button.annotationCommentButton`
431+ )
432+ . addEventListener ( "focus" , resolve , { once : true } ) ;
433+ } ) ;
434+ await page . click ( "#commentManagerSaveButton" ) ;
435+ await awaitPromise ( handle ) ;
436+ } )
437+ ) ;
438+ } ) ;
439+ } ) ;
440+
379441 describe ( "Comment sidebar" , ( ) => {
380442 let pages ;
381443
0 commit comments