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

chore(inline-time-picker): support focus and focus traps (VIV-2296) #2146

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

RichardHelm
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Feb 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (d61b119) to head (665e651).
Report is 1293 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##              main     #2146      +/-   ##
============================================
  Coverage   100.00%   100.00%              
============================================
  Files          123       353     +230     
  Lines         1562     16230   +14668     
  Branches       108      2916    +2808     
============================================
+ Hits          1562     16230   +14668     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@YonatanKra YonatanKra left a comment

Choose a reason for hiding this comment

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

I commented on the changes for inline-time-picker.
We all agreed to work in small interations. That means, each PR should have a single purpose and as few files changed as possible.
To do that, we should finish this PR for the inline-time-picker focus handling, merge it, and then move on to using inline-time-picker. The idea is to merge what's ready.

@@ -596,5 +596,33 @@ describe('vwc-inline-time-picker', () => {
expect(isScrolledIntoView(getPickerItem('hours', '00'))).toBe(true);
});
});

describe('focus trap support', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO describes should describe API's.
I know there's more like this in our codebase. It should be refactored.
Anyway, it describes nothing but a single use case so should be removed and its it remain under keyboard interactions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, I think we should use describe to group related behaviour. This is similar to how we have describe("form association") in the codebase.

I don't want to move this under "time picker > keyboard navigation" as it has nothing to do with keyboard navigation for picking times

Copy link
Contributor

Choose a reason for hiding this comment

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

What scenario does it test? What user action?

TrappedFocus.ignoreEvent = originalIgnoreEvent;
});

it('should submit Tab keydown events that move focus internally to be ignored by focus traps', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

What I see in this test is:
Focus on hours, press tab, expect ignoreEvent method to be called once with the Tab event.
Can you please write the description in the form of: should {doSomething} when {someThing}?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And how will you understand the purpose without this description? I think it will not become clearer by phrasing it like that

@RichardHelm
Copy link
Contributor Author

@YonatanKra Sure, I've split the PR

@RichardHelm RichardHelm changed the title chore(time-picker): use inline-time-picker (VIV-2296) chore(inline-time-picker): support focus and focus traps (VIV-2296) Feb 18, 2025
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.

2 participants