Skip to content

Conversation

MisRob
Copy link
Member

@MisRob MisRob commented Nov 13, 2024

Description

KCard is updated for more flexible click event handling. Previously, its title text was always router-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 click
  • to prop is not required
  • when to is provided, the title text is router-link, and the card navigates to the target
  • when to is not provided, the title text is span, and the card doesn't navigate anywhere

Contains related a11y changes that increase screen reader reliability overall:

  • Make title prop required and allow title customization via a scoped slot
  • 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.

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.

Screenshot from 2024-11-13 16-33-50

Changelog

  • Description: Make the title prop required

  • 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: yes

  • Impacts a11y: no

  • Guidance: Even if you use the title slot, pass the title text via the title prop.

  • Description: Change the title slot into a scoped slot

  • 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: 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 as router-link but rather as span.

  • 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

  • You could run the devserver, play around with to and @click on the DocsKCard and preview live example on KCard docs page.
  • Is the updated documentation section clear?
  • Can you see any functional, markup, or a11y regressions?

Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical and brittle code paths are covered by unit tests
  • The change is described in the changelog section above

Reviewer guidance

  • Is the code clean and well-commented?
  • Are there tests for this change?
  • Are all UI components LTR and RTL compliant (if applicable)?
  • Add other things to check for here

Comments

@MisRob MisRob requested a review from AlexVelezLl November 13, 2024 19:20
@MisRob MisRob requested review from AllanOXDi and akolson November 13, 2024 19:20
@MisRob MisRob added the TODO: needs review Waiting for review label Nov 13, 2024
@MisRob MisRob force-pushed the card-click-api branch 2 times, most recently from 4bbf11b to c49c1a3 Compare November 13, 2024 19:32
and add a click event. This allows for
a custom handler.
Copy link
Member

@AllanOXDi AllanOXDi left a 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

Copy link
Member

@AlexVelezLl AlexVelezLl left a 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.
@MisRob
Copy link
Member Author

MisRob commented Nov 20, 2024

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)

@MisRob MisRob requested a review from AlexVelezLl November 20, 2024 20:51
@MisRob
Copy link
Member Author

MisRob commented Nov 20, 2024

In the new docs example, please ignore the thumbnail overflow issue - I shoud have this fixed in another branch

Copy link
Member

@AlexVelezLl AlexVelezLl left a 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!

@MisRob MisRob merged commit a43f175 into learningequality:develop Nov 20, 2024
9 checks passed
learning-equality-bot bot pushed a commit that referenced this pull request Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TODO: needs review Waiting for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants