-
Notifications
You must be signed in to change notification settings - Fork 101
More flexible KCard click event handling #825
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
Conversation
f97ea37
to
2e3fab5
Compare
4bbf11b
to
c49c1a3
Compare
and add a click event. This allows for a custom handler.
c49c1a3
to
9396a65
Compare
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.
Looks good to me !Thanks Misha, maybe @akolson and @AlexVelezLl has something to say
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.
Hi @MisRob! I just noted a couple of things I would like to discuss about :)
and allow title customization via a scoped slot. Contains related work to ensure reliable screen readers announcements no matter whether card is link or no, and no matter whether the title is customized via the title slot.
Thanks @AllanOXDi @AlexVelezLl, all feedback is resolved, changelog and PR description updated with new information. I tested screenreaders in all modes. As soon as we have some working features in Kolibri, we will loop in Radina for final confirmation (outside this PR though I'd suggest because there's way more a11y we'll be testing in the final products) |
In the new docs example, please ignore the thumbnail overflow issue - I shoud have this fixed in another branch |
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.
Thank you @MisRob! Looks good to me!
Description
KCard
is updated for more flexible click event handling. Previously, its title text was alwaysrouter-link
,to
prop was required, and the card would navigate to the target on click. The new behavior is:click
event is always emitted on card clickto
prop is not requiredto
is provided, the title text isrouter-link
, and the card navigates to the targetto
is not provided, the title text isspan
, and the card doesn't navigate anywhereContains related a11y changes that increase screen reader reliability overall:
Issue addressed
A new use-case in Studio that @akolson works on in learningequality/studio#4803 where a side panel needs to be toggled on card click without navigating to a new URL.
Changelog
Description: Make the
title
prop requiredProducts impact: updated API
Addresses: A new use-case in Studio in Implement recommendations display studio#4803 where a side panel needs to be toggled on card click without changing URL.
Components: KCard
Breaking: yes
Impacts a11y: no
Guidance: Even if you use the
title
slot, pass the title text via thetitle
prop.Description: Change the
title
slot into a scoped slotProducts impact: updated API
Addresses: A new use-case in Studio in Implement recommendations display studio#4803 where a side panel needs to be toggled on card click without changing URL.
Components: KCard
Breaking: no
Impacts a11y: no
Guidance: Consider using the slot's
textTitle
attribute to achieve more intuitive code when customizing the title.Description: Emit
click
event when card is clicked.Products impact: updated API
Addresses: A new use-case in Studio in Implement recommendations display studio#4803 where a side panel needs to be toggled on card click without changing URL.
Components: KCard
Breaking: no
Impacts a11y: no
Guidance: -
Description: Make
to
prop optional and when not provided, do not render the title text asrouter-link
but rather asspan
.Products impact: updated API
Addresses: A new use-case in Studio in Implement recommendations display studio#4803 where a side panel needs to be toggled on card click without changing URL.
Components: KCard
Breaking: no
Impacts a11y: no
Guidance: -
Description: Ensure reliable screen readers announcements no matter whether card is link or no, and no matter whether the title is customized via the title slot
Products impact: bugfix
Addresses: A new use-case in Studio in Implement recommendations display studio#4803 where a side panel needs to be toggled on card click without changing URL.
Components: KCard
Breaking: no
Impacts a11y: yes
Guidance: -
Steps to test
to
and@click
on the DocsKCard and preview live example onKCard
docs page.Testing checklist
If there are any front-end changes, before/after screenshots are includedReviewer guidance
Comments