Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ const SpanBarRow: React.FC<SpanBarRowProps> = ({
onChildrenToggled(span.spanID);
}, [onChildrenToggled, span.spanID]);

const _detailToggleKeyDown = useCallback(
(e: React.KeyboardEvent) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
onDetailToggled(span.spanID);
}
},
[onDetailToggled, span.spanID]
);
Comment on lines +97 to +105
const {
duration,
hasChildren: isParent,
Expand Down Expand Up @@ -143,6 +152,7 @@ const SpanBarRow: React.FC<SpanBarRowProps> = ({
className={`span-name ${isDetailExpanded ? 'is-detail-expanded' : ''}`}
aria-checked={isDetailExpanded}
onClick={_detailToggle}
onKeyDown={_detailToggleKeyDown}
role="switch"
style={{ borderColor: color }}
tabIndex={0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,25 @@ export const UnconnectedSpanTreeOffset: React.FC<TProps> = ({
};

const { hasChildren, spanID, childSpans } = span;
const wrapperProps = hasChildren ? { onClick, role: 'switch', 'aria-checked': childrenVisible } : null;
const _childrenToggleKeyDown = (e: React.KeyboardEvent) => {
if ((e.key === 'Enter' || e.key === ' ') && onClick) {
e.preventDefault();
onClick();
}
};
Comment thread
yurishkuro marked this conversation as resolved.

const wrapperProps = hasChildren
? {
onClick,
...(onClick && {
onKeyDown: _childrenToggleKeyDown,
tabIndex: 0,
}),
role: 'switch',
'aria-checked': childrenVisible,
'aria-label': 'Expand or collapse child spans',
}
: null;
Comment thread
yurishkuro marked this conversation as resolved.
Outdated

// Get parent color for horizontal line
const parentSpan = span.parentSpan;
Expand Down
Loading