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

fix(List, ListItem): Improve accessibility for List and migrate tests #949

Merged
merged 13 commits into from
May 15, 2023

Conversation

PavelKirvelTextkernel
Copy link
Contributor

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. Use imperative, present tense in your commit description ("change", not "changed" or "changes") without uppercases or period (.) at the end.

Task link: https://textkernel.atlassian.net/browse/ONEUI-364

@PavelKirvelTextkernel PavelKirvelTextkernel force-pushed the ONEUI-364_Migrate_List_tests branch 3 times, most recently from 766b0ba to eb58ab1 Compare April 24, 2023 05:39
@PavelKirvelTextkernel PavelKirvelTextkernel force-pushed the ONEUI-364_Migrate_List_tests branch from eb58ab1 to 42d76dc Compare April 24, 2023 08:39
@PavelKirvelTextkernel PavelKirvelTextkernel changed the title One UI 364 migrate list tests test: migrate list tests Apr 24, 2023
@PavelKirvelTextkernel
Copy link
Contributor Author

Related to forgotten comment i haven't finished those tests yet


expect(mockOnClick).toBeCalledWith(2);
});
it.skip('should not call onClick after navigating to the next highlighted item', async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm a bit stuck with this tests case.
Here we click on element and then expect that Enter will not clicked or first click doesn't count ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I tried to fix it, but indeed took me quite a bit of time to figure out what these tests should do, and why they don't really work. While investigating, I ended up refactoring quite a bit if the file, adding some tests, and deleting others. I think the suit looks better now (but I'm biased 😝). Since there were so many changes, I thought it is easier to just push my changes instead of trying to describe them here. It is your PR, if you don't like my changes, you can revert them and apply only the parts you think make sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've checked it looks great

PavelKirvelTextkernel and others added 4 commits April 27, 2023 15:49
# Conflicts:
#	TESTING_LIBRARY_MIGRATION.md
#	src/components/Chip/__tests__/Chip.spec.tsx
#	src/components/Dropdown/__tests__/Dropdown.spec.tsx
#	src/components/FieldWrapper/__tests__/FieldWrapper.spec.tsx
#	src/components/SelectComponents/Autosuggest/__tests__/Autosuggest.spec.tsx
#	src/components/SelectComponents/Combobox/__tests__/Combobox.spec.tsx
#	src/components/SelectComponents/ComboboxMulti/__tests__/ComboboxMulti.spec.tsx
onClick={onClick}
aria-selected={isHighlighted}
onKeyDown={onClick}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this isn't the best practice to call onClick for any key press. Normally it is only Enter that should trigger it. Can you make it a handle function instead, that calls the callback only in that case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've pushed changes for this action could you please check it

Copy link
Contributor

Choose a reason for hiding this comment

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

I had a quick look, and it looks ok. however, as mentioned in the other comment, I'm still looking into it. My concern is that a ListItem that doesn't have an onClick handles now still looks like an interactive element with onKeyDown and role=option. I'm trying to figure out what is the best way to go about it. Can you leave this PR for me for a bit until I figure these out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure

@eszthoff eszthoff changed the title test: migrate list tests fix(List, ListItem): Improve accessibility for List and migrate tests May 10, 2023
@eszthoff eszthoff requested a review from mukiienko May 11, 2023 08:49
@PavelKirvelTextkernel PavelKirvelTextkernel merged commit 08d7ffe into master May 15, 2023
@PavelKirvelTextkernel PavelKirvelTextkernel deleted the ONEUI-364_Migrate_List_tests branch May 15, 2023 10:42
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