-
Notifications
You must be signed in to change notification settings - Fork 11
fix: pickListItem. spacebar on secondaryAction no longer toggles selection #326
fix: pickListItem. spacebar on secondaryAction no longer toggles selection #326
Conversation
No longer checks/unchecks the list item
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are a couple issues with the structure here. The onclick for the secondaryAction should be a <button>
element so that it supports spacebar/enter key to trigger it.
What might be better to fix this issue is to move the onclick from the Host
to the <label>
Then there are no longer any nested "buttons".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving the onclick to the label would severely reduce the hit area. I don't think that's a valid option.
That can be addressed by styling. (Moving the padding from the host to the label).
The issue is similar to what we have in the API layerlist widget. The hit area shouldn't be the whole item, just the label and checkbox. Then you won't have nested buttons or have to prevent the internal click from bubbling.
src/components/calcite-pick-list-item/calcite-pick-list-item.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to merge once @driskull's feedback is addressed.
src/components/calcite-pick-list-item/calcite-pick-list-item.tsx
Outdated
Show resolved
Hide resolved
@driskull I made the updates you suggested, however I still had to keep the onkeydown event on the host because I was getting a typescript error when I tried putting it on the label. Therefore I also had to keep that condition in the event handler. |
Ok.
I ran into that issue before and used a |
That's weird. I don't see why it would be typed to allow one vs the other. Maybe it's a Stencil bug. |
yeah. I'm not sure either. Maybe some investigation or bug issue for them. @pr3tori4n would |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you try moving the onKeyDown
to the <label>
element. I think an update might have fixed that bug. 👍
Good to merge once conflicts resolved.
neither onKeydown or onKeyup is passing typescript validation on the label element. @driskull how would you like to proceed? |
…b.com:Esri/calcite-app-components into hrobbins/picklist-secondaryActionSpaceBar-309
Checked out local branch and this seems to work:
|
@pr3tori4n Also seeing this: The JSDoc errors |
We can merge this in and have a followup issue for the key handler. Lets fix the jsdoc though. |
It might be being fickle on the casing. I was using |
…b.com:Esri/calcite-app-components into hrobbins/picklist-secondaryActionSpaceBar-309
Created issue for the handler. #433 I think we just need to delete the jsdoc for anything with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good.
src/components/calcite-pick-list-item/calcite-pick-list-item.scss
Outdated
Show resolved
Hide resolved
src/components/calcite-pick-list-item/calcite-pick-list-item.tsx
Outdated
Show resolved
Hide resolved
It's not being fickle, it's being correct. Look at |
…check for slot on event now that its on the label.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
onKeyDown={this.pickListKeyDownHandler} | ||
role="checkbox" | ||
aria-checked={this.isSelected} | ||
tabindex="0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Nitpick] We should be using tabIndex
, no? We can do inventory on this in a follow-up issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. fixed! only found a couple
Related Issue: #309
Summary
pressing spacebar while the secondary action is focused no longer checks/unchecks the list item.