@@ -2,6 +2,7 @@ import * as icons from "../../helpers/icons";
2
2
import * as misc from "../../helpers/misc" ;
3
3
import * as svg from "../../helpers/svg" ;
4
4
import { Context } from "../../typing/context" ;
5
+ import { OpenOverlay } from "../../typing/open-overlay" ;
5
6
import { RectData } from "../../typing/rect-data" ;
6
7
import { WaterfallEntry } from "../../typing/waterfall" ;
7
8
import { getIndicatorIcons } from "./svg-indicators" ;
@@ -20,12 +21,13 @@ const ROW_LEFT_MARGIN = 3;
20
21
export function createRow ( context : Context , index : number ,
21
22
maxIconsWidth : number , maxNumberWidth : number ,
22
23
rectData : RectData , entry : WaterfallEntry ,
23
- onDetailsOverlayShow : EventListener ) : SVGGElement {
24
+ onDetailsOverlayShow : EventListener ) : SVGAElement {
24
25
25
26
const y = rectData . y ;
26
27
const rowHeight = rectData . height ;
27
28
const leftColumnWith = context . options . leftColumnWith ;
28
- let rowItem = svg . newG ( entry . responseDetails . rowClass ) ;
29
+ let rowItem = svg . newA ( entry . responseDetails . rowClass ) ;
30
+ rowItem . setAttribute ( "href" , "javascript:void(0)" ) ;
29
31
let leftFixedHolder = svg . newSvg ( "left-fixed-holder" , {
30
32
"width" : `${ leftColumnWith } %` ,
31
33
"x" : "0" ,
@@ -36,8 +38,8 @@ export function createRow(context: Context, index: number,
36
38
} ) ;
37
39
38
40
let rect = rowSubComponents . createRect ( rectData , entry . segments , entry . total ) ;
39
- let rowName = rowSubComponents . createNameRowBg ( y , rowHeight , onDetailsOverlayShow ) ;
40
- let rowBar = rowSubComponents . createRowBg ( y , rowHeight , onDetailsOverlayShow ) ;
41
+ let rowName = rowSubComponents . createNameRowBg ( y , rowHeight ) ;
42
+ let rowBar = rowSubComponents . createRowBg ( y , rowHeight ) ;
41
43
let bgStripe = rowSubComponents . createBgStripe ( y , rowHeight , ( index % 2 === 0 ) ) ;
42
44
43
45
let x = ROW_LEFT_MARGIN + maxIconsWidth ;
@@ -73,6 +75,84 @@ export function createRow(context: Context, index: number,
73
75
74
76
rowSubComponents . appendRequestLabels ( rowName , requestNumberLabel , shortLabel , fullLabel ) ;
75
77
78
+ // const onOpenOverlayFocusOut = (evt: KeyboardEvent) => {
79
+ // if (evt.which !== 9) {
80
+ // return; // only handle tabs
81
+ // }
82
+ // const isUpward = evt.shiftKey;
83
+ // console.log("onActiveFocusOut", isUpward);
84
+ // };
85
+
86
+ // accordeon a11y guide
87
+ // https://www.w3.org/TR/wai-aria-practices-1.1/#accordion
88
+ context . pubSub . subscribeToSpecificOverlayChanges ( index , ( change ) => {
89
+ console . log ( "onOverlayChange" , change . type ) ;
90
+ if ( change . type === "open" ) {
91
+ openOverlay = change . changedOverlay ;
92
+ } else {
93
+ openOverlay = undefined ;
94
+ }
95
+ } ) ;
96
+
97
+ let isPoinerClick = false ;
98
+ let openOverlay : OpenOverlay ;
99
+ // let showDetailsTimeout: number;
100
+ // triggered before click by touch and mouse devices
101
+ rowItem . addEventListener ( "mouseup" , ( ) => {
102
+ isPoinerClick = true ;
103
+ } ) ;
104
+ rowItem . addEventListener ( "click" , ( evt : MouseEvent ) => {
105
+ isPoinerClick = false ;
106
+ onDetailsOverlayShow ( evt ) ;
107
+ } ) ;
108
+ rowItem . addEventListener ( "keydown" , ( evt : KeyboardEvent ) => {
109
+ if ( evt . which === 32 ) {
110
+ evt . preventDefault ( ) ;
111
+ onDetailsOverlayShow ( evt ) ;
112
+ }
113
+ if ( evt . which === 9 ) {
114
+ if ( openOverlay ) {
115
+ // const overlayCount = context.overlayManager.getOpenOverlays().length;
116
+ // if(openOverlay.index){
117
+
118
+ // }
119
+ // openOverlay.
120
+ } else {
121
+ let nextRowItem = evt . shiftKey ? rowItem . previousSibling : rowItem . nextSibling ;
122
+ nextRowItem . lastChild . lastChild . dispatchEvent ( new MouseEvent ( "mouseenter" ) ) ;
123
+ }
124
+ }
125
+ } ) ;
126
+
127
+ // rowItem.addEventListener("keyup", (evt: KeyboardEvent) => {
128
+ // if (evt.which === 9) {
129
+ // //document.activeElement === rowItem
130
+ // console.log("keydown");
131
+ // rowName.dispatchEvent(new MouseEvent("mouseenter"));
132
+ // window["eventsStore"]["key"].push(evt);
133
+ // }
134
+ // });
135
+
136
+
137
+ // rowItem.addEventListener("focusin", (evt: FocusEvent) => {
138
+ // console.log("in", isPoinerClick);
139
+ // // const test = new MouseEvent("mouseenter");
140
+ // rowName.dispatchEvent(new MouseEvent("mouseenter"));
141
+ // window["eventsStore"]["mouse"].push(evt);
142
+ // });
143
+
144
+
145
+ rowItem . addEventListener ( "focusout" , ( ) => {
146
+ console . log ( "out" ) ;
147
+ rowName . dispatchEvent ( new MouseEvent ( "mouseleave" ) ) ;
148
+ } ) ;
149
+
150
+ // rowItem.addEventListener("click", (evt) => {
151
+ // console.log("click", evt);
152
+ // onDetailsOverlayShow(evt);
153
+ // });
154
+
155
+
76
156
flexScaleHolder . appendChild ( rowBar ) ;
77
157
leftFixedHolder . appendChild ( clipPathElProto . cloneNode ( true ) ) ;
78
158
leftFixedHolder . appendChild ( rowName ) ;
0 commit comments