@@ -650,7 +650,7 @@ class ClassHelper extends HTMLElement {
650650 data . forEach ( ( entry ) => {
651651 const row = document . createElement ( 'tr' ) ;
652652 row . dataset . id = entry [ headers [ 0 ] ] ;
653- row . setAttribute ( "tabindex" , 1 ) ;
653+ row . setAttribute ( "tabindex" , 0 ) ;
654654
655655 const checkbox = document . createElement ( "input" ) ;
656656 checkbox . setAttribute ( "type" , "checkbox" ) ;
@@ -692,34 +692,6 @@ class ClassHelper extends HTMLElement {
692692 } ) ) ;
693693 } ) ;
694694
695- this . popupRef . document . addEventListener ( "keydown" , ( e ) => {
696- if ( e . target . tagName == "TR" ) {
697- if ( e . key === "ArrowDown" ) {
698- if ( e . target . nextElementSibling != null ) {
699- e . target . nextElementSibling . focus ( ) ;
700- } else {
701- e . target . parentElement . firstChild . focus ( ) ;
702- }
703- }
704- if ( e . key === "ArrowUp" ) {
705- if ( e . target . previousElementSibling != null ) {
706- e . target . previousElementSibling . focus ( ) ;
707- } else {
708- e . target . parentElement . lastChild . focus ( ) ;
709- }
710- }
711- if ( e . key === "Enter" || e . key === " " ) {
712- let tr = e . target ;
713- tr . children . item ( 0 ) . checked = ! tr . children . item ( 0 ) . checked ;
714- this . dispatchEvent ( new CustomEvent ( "selection" , {
715- detail : {
716- value : tr . dataset . id
717- }
718- } ) ) ;
719- }
720- }
721- } ) ;
722-
723695 // Create table footer with the same column values as headers
724696 const footerRow = document . createElement ( 'tr' ) ;
725697 let footThx = document . createElement ( "th" ) ;
@@ -820,6 +792,56 @@ class ClassHelper extends HTMLElement {
820792
821793 const accumulatorFrag = this . getAccumulatorFragment ( preSelectedValues ) ;
822794 popupBody . appendChild ( accumulatorFrag ) ;
795+
796+ this . popupRef . document . addEventListener ( "keydown" , ( e ) => {
797+ if ( e . target . tagName == "TR" ) {
798+ if ( e . key === "ArrowDown" ) {
799+ if ( e . target . nextElementSibling != null ) {
800+ e . target . nextElementSibling . focus ( ) ;
801+ } else {
802+ e . target . parentElement . firstChild . focus ( ) ;
803+ }
804+ }
805+ if ( e . key === "ArrowUp" ) {
806+ if ( e . target . previousElementSibling != null ) {
807+ e . target . previousElementSibling . focus ( ) ;
808+ } else {
809+ e . target . parentElement . lastChild . focus ( ) ;
810+ }
811+ }
812+ if ( e . key === "Enter" || e . key === " " ) {
813+ let tr = e . target ;
814+ tr . children . item ( 0 ) . checked = ! tr . children . item ( 0 ) . checked ;
815+ this . dispatchEvent ( new CustomEvent ( "selection" , {
816+ detail : {
817+ value : tr . dataset . id
818+ }
819+ } ) ) ;
820+ }
821+ if ( e . key === "ArrowRight" ) {
822+ this . popupRef . document . getElementById ( "popup-pagination" ) . lastChild . focus ( ) ;
823+ }
824+ if ( e . key === "ArrowLeft" ) {
825+ this . popupRef . document . getElementById ( "popup-pagination" ) . firstChild . focus ( ) ;
826+ }
827+ return ;
828+ }
829+
830+ if ( e . target . tagName != "INPUT" && e . target . tagName != "SELECT" ) {
831+ if ( e . key === "ArrowDown" ) {
832+ this . popupRef . document . querySelector ( "tr.rowstyle" ) . parentElement . firstChild . focus ( ) ;
833+ }
834+ if ( e . key === "ArrowUp" ) {
835+ this . popupRef . document . querySelector ( "tr.rowstyle" ) . parentElement . lastChild . focus ( ) ;
836+ }
837+ if ( e . key === "ArrowRight" ) {
838+ this . popupRef . document . getElementById ( "popup-pagination" ) . lastChild . focus ( ) ;
839+ }
840+ if ( e . key === "ArrowLeft" ) {
841+ this . popupRef . document . getElementById ( "popup-pagination" ) . firstChild . focus ( ) ;
842+ }
843+ }
844+ } ) ;
823845 }
824846
825847 /** method when next or previous button is clicked
0 commit comments