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

KCardGrid part 2: Add KCardGrid with the base layouts + Add selection controls + Final documentation for KCard and KCardGrid + Few KCard bugfixes and improvements #785

Merged
merged 44 commits into from
Oct 1, 2024

Conversation

MisRob
Copy link
Member

@MisRob MisRob commented Sep 17, 2024

Description

KCard bugfixes, visual and public API updates

  • Adds support for selection controls such as checkboxes
  • Updates related to spaces between sections:
    • Aligns spaces more closely to designs
    • Introduces more robust spacing technique to ensures spaces are rendered as expected no matter of whether some/all/none slots are displayed
    • Improves calculations coordinating space taken by the thumbnail and other content in the horizontal orientation so that no free space is wasted (progressive update taking effect in browsers that support clamp())
Before After
Screenshot from 2024-09-17 20-57-49 Screenshot from 2024-09-17 20-58-57
  • Hides the placeholder after the thumbnail image is loaded
  • Renames titleLines prop to titleMaxLines
  • Renames layout prop to orientation

KCardGrid

  • Introduces KCardGrid with the base layouts
  • KCard updates to make screen readers announce only card titles when navigating the grid with TAB key

Docs

  • Organizes and adds more guidance for KCard docs
  • Adds new KCardGrid docs
  • New documentation components to help with organizing larger amounts of guidance: DocsSubNav, DocsToggleButton, DocsToggleContent, DocsTable
  • Slightly increases the width of the main documentation area to better demonstrate grids

Also has some minor cleanup.

See details and reasons for changes in commit messages.

References

Changelog

  • Description: Renames KCard's titleLines prop to titleMaxLines

  • Products impact: updated API

  • Addresses: -

  • Components: KCard

  • Breaking: yes

  • Impacts a11y: no

  • Guidance: Rename the prop

  • Description: Renames KCard's layout prop to orientation

  • Products impact: updated API

  • Addresses: -

  • Components: KCard

  • Breaking: yes

  • Impacts a11y: no

  • Guidance: Rename the prop

  • Description: Adds support to KCard for selection controls such as checkboxes

  • Products impact: new API

  • Addresses: -

  • Components: KCard

  • Breaking: no

  • Impacts a11y: yes

  • Guidance: -

  • Description: Improves spaces display in KCard

  • Products impact: visual update

  • Addresses: -

  • Components: KCard

  • Breaking: no

  • Impacts a11y: no

  • Guidance: -

  • Description: Hides KCard placeholder element after the thumbnail image is loaded

  • Products impact: bugfix

  • Addresses: Resolves issue when parts of the placeholder element was visible behind a small thumbnail image

  • Components: KCard

  • Breaking: no

  • Impacts a11y: no

  • Guidance: -

  • Description: Updates KCard to make screen readers announce only card titles when navigating the grid with TAB key

  • Products impact: bugfix

  • Addresses: Resolves unexpected behavior when overwhelming amounts of information was announced when navigating the card list with TAB

  • Components: KCard

  • Breaking: no

  • Impacts a11y: no

  • Guidance: -

  • Description: Introduces KCardGrid (with internal related KCard updates)

  • Products impact: new API

  • Addresses: KCardGrid MVP and specification #697, KCard: Allow the height of sections to be configured and related improvements #703

  • Components: KCardGrid

  • Breaking: no

  • Impacts a11y: no

  • Guidance: -

  • Description: Adds detailed guidance to KCard and KCardGrid documentation pages

  • Products impact: none

  • Addresses: Add new design pattern documentation page for cards #264, Add more guidance to KCard docs #696

  • Components: KCard, KCardGrid

  • Breaking: no

  • Impacts a11y: no

  • Guidance: -

  • Description: Adds new documentation components: DocsSubNav, DocsToggleButton, DocsToggleContent, DocsTable

  • Products impact: none

  • Addresses: Helps with organizing larger amounts of guidance on documentation pages

  • Components: -

  • Breaking: no

  • Impacts a11y: no

  • Guidance: -

  • Description: Slightly increases the width of the main documentation area

  • Products impact: none

  • Addresses: Helps to better demonstrate components requiring more space on documentation pages, such as card grids

  • Components: -

  • Breaking: no

  • Impacts a11y: no

  • Guidance: -

Steps to test

  • Read both documentation pages for KCard and KCardGrid

    • Is all guidance clear?
    • Is there some missing guidance?
  • Test live examples on both documentation pages

    • Preview resulting markup
    • Try keyboard navigation
    • Try screen reader output

I can also provide a copy of the playground page with all visual layouts. However now when there's many live examples on documentation pages, for the purpose of review it would make more sense to use them as they offer larger variety regarding card content.

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

  • This PR completes all main pieces currently needed in Kolibri and Studio. After it's merged, we can close [BETA] Card grid and checkboxes #748 and link to KDS latest release.
  • Next PRs in the series will introduce useKCardGrid for advanced grid customization and loading states

to have a suitable location
for playground sub-components
when testing complex scenarios
alongside the existing very small picture
to allow for testing in both cases.
to visually separate it from the footer slot.
to allow components that required more space
to demonstrate their function in relevant ways,
such as grids.
Ensures spaces are rendered as expected
no matter of whether some/all/none slots
are displayed. Also aligns spaces more closely
to designs.
and use constants to define thumbnail width
so they can be later referenced instead
of hardcoded values..
the content area next to it more intelligently
in browsers that support `clamp()` by:

 - Instead of defining 'width', 'min-width', and 'max-width' separately,
   `clamp()` is used with the goal to have the actual thumbnail width
   saved in the single `$thumbnail-width` value.

- The `$thumbnail-width` value is then referenced when calculating
  the remaining space for the content area, ensuring the precise
  distribution of space.

Resolves some issues related to unprecise calculations, most importantly
this removes the area of empty space between the thumbnail and content areas
in some card's sizes, wasting space that can be used for card's textual content.
Otherwise in some scenarios, such as when there is a large
placeholder element and a small thumbnail image, some parts
of the placeholder element may be visible behind the image
after it has been successfully loaded.
to communicate its function more clearly
to communicate its purpose.

The card layout is rather a combination
of its orientation and the thumbnail area
configuration.
when navigating the list of cards with TAB key.

This resolves overwhelming output and aligns the screenreader
navigation to the expected experience when on TAB only card titles
should be announced (other content is still accessible by  navigating
with arrows).

The main culprit that caused all content of cards being announced
was 'tabindex=0' set on <li>. To resolve the problem,
an alternative technique that doesn't require this tabindex is used
to make the focus ring display around the whole card area.
by screenreaders and add some docs.
This information, with more, is now documented
in the main documentaton sections.
@MisRob MisRob changed the title KCardGrid part 2: Add KCardGrid with the base layouts + Final documentation for KCard and KCardGrid + Few KCard bugfixes KCardGrid part 2: Add KCardGrid with the base layouts + Add selection controls + Final documentation for KCard and KCardGrid + Few KCard bugfixes and improvements Sep 17, 2024
@MisRob MisRob marked this pull request as ready for review September 17, 2024 19:15
Documentation page is better suited for this and it
already explains grid layouts in detail.
@MisRob
Copy link
Member Author

MisRob commented Sep 20, 2024

Thanks a lot @AllanOXDi. I pushed some updates and left couple of clarifying questions.

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!! This is looking great!! Loved how KCard and KCardGrid docs are structured, and code changes looks good to me. I left just a couple of questions/concerns, that Im not sure if falls in the scope of this PR. Thanks!

docs/pages/kcard.vue Outdated Show resolved Hide resolved
docs/pages/kcardgrid.vue Show resolved Hide resolved
lib/cards/KCard.vue Show resolved Hide resolved
lib/cards/KCardGrid.vue Show resolved Hide resolved
@LianaHarris360
Copy link
Member

LianaHarris360 commented Sep 24, 2024

I've read over the documentation a bit and only noticed a few things:

  1. There's a typo in this sentence

kcard1

  1. When you click on a card within the documentation, you see an error message saying "This page could not be found." Could we make it so that the card is still clickable, but clicking it just keeps the user on the same page (or takes the user nowhere or perhaps to the top of that section) instead of opening that page?

kcard2

@radinamatic
Copy link
Member

Excellent work @MisRob , I'm so 😍 with the progress here! 👏🏽 🏅 💯

Even though some further attention will be necessary for proper labeling of the interactive elements within the card, this is a very strong and accessible foundation! Keyboard navigation is fluid, without hickups, and with the order we agreed upon, screen reader output is according to the expectations! 🎉

Bookmark Checkbox
KCard KCard2

Regarding checkboxes toggling working only with SPACE but not ENTER, I noticed ENTER is not working on our KCheckboxes in general. So if that was expected experience, we will need to fix, just not in the scope of this work. Will wait for your confirmation and can open issue.

According to the W3C ARIA Authoring Practices Guide, the expected checkbox pattern requires only the Space key to change the state from checked to unchecked and back, so we should be good 🙂

Copy link
Member

@radinamatic radinamatic left a comment

Choose a reason for hiding this comment

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

Accessibility-wise, this is ready to 🚀! 🙂 🎉 :shipit:

@marcellamaki
Copy link
Member

@MisRob - I have read through the documentation and find it comprehensive and well-organized. There may be things that we end up wanting to add or adjust as we start implementing (and I think it would be ideal if some of the engineers who are less familiar with this do some of the refactoring work in 0.18, so we can get a new perspective on the work and documentation and see what additional information is useful for the team. (I haven't done any code review, as it seems as though that's been covered by others, and that Radina has done comprehensive accessibility QA as well)

@MisRob
Copy link
Member Author

MisRob commented Sep 26, 2024

@LianaHarris360 Thank you.

(1) Fixed
(2) Yes, that'd be nice. I redirected to the "Guidelines" section so we can still easily recognize navigation works.

@MisRob
Copy link
Member Author

MisRob commented Sep 26, 2024

Good news @radinamatic, thank you

@MisRob
Copy link
Member Author

MisRob commented Sep 26, 2024

Thanks for reading through it @marcellamaki. Yes, it'd be great if cards could be now used by more developers who would give feedback.

@MisRob
Copy link
Member Author

MisRob commented Sep 26, 2024

All actionable feedback addressed. I am going to update changelog and open 'beta' -> 'this final version' migration issues for existing Kolibri and Studio cards and then we can merge.

@MisRob MisRob merged commit 3e5da74 into learningequality:develop Oct 1, 2024
10 of 11 checks passed
learning-equality-bot bot pushed a commit that referenced this pull request Oct 1, 2024
@MisRob MisRob mentioned this pull request Oct 1, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants