Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CB-5446 chore: keyboard navigation improvements #2935

Merged
merged 3 commits into from
Sep 26, 2024

Conversation

Wroud
Copy link
Member

@Wroud Wroud commented Sep 26, 2024

No description provided.

@Wroud Wroud self-assigned this Sep 26, 2024
Comment on lines +33 to +35
} else {
el.setAttribute('tabindex', '-1');
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this set of elements can include elements without aria-selected attribute. Is this okay to set tabIndex for them also to -1? Or it is supposed to be only for elements with aria-selected attribute?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is okay, if element don't have this attribute then tabindex=-1 is okay, but here more problems over -1 and 0 because sometimes you can't restore initial value (when you don't have aria-selected or when element was tabindex=0 initially)

but for now seems that it works, maybe we will found bugs related to this function later

switch (e.key) {
case 'ArrowRight':
case 'ArrowDown':
newIndex = (currentIndex + 1) % focusableElements.length; // Move to next element
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets move to next/prev element into functions

right: 0;
bottom: 0;
outline-offset: -1px;
outline: -webkit-focus-ring-color auto 1px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -69,6 +71,10 @@ export const TableViewer = observer<TableViewerProps, HTMLDivElement>(
const loading = dataModel?.isLoading() ?? true;
const dataFormat = result?.dataFormat || ResultDataFormat.Resultset;
const splitState = useSplitUserState('table-viewer');
const navRef = useListKeyboardNavigation(
'[data-presentation][tabindex]:not(:disabled), [data-presentation-tools][tabindex]:not(:disabled), [data-presentation-header][tabindex]:not(:disabled), [data-presentation-bar][tabindex]:not(:disabled)',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just an idea (not required to implement right now): we should implement some kind of selector builder with chain of responsibility pattern cause now it is easy to miss-type something and get a bug

@Wroud Wroud merged commit 0bf6783 into devel Sep 26, 2024
6 of 7 checks passed
@Wroud Wroud deleted the feat/cb-5446/keyboard-navigation-imporvements branch September 26, 2024 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants