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

[#12279] Instructor home page: Improve display of card header on mobile #12567

Merged

Conversation

Mex7180
Copy link
Contributor

@Mex7180 Mex7180 commented Aug 24, 2023

Fixes #12279

Card-header-toolbar changed to display as flex-container on mobile screens (see screenshots below) and changed from div-element to button element for screenreader compatibility.
An other option would be with using grid to create a 2X2 grid with all 4 buttons. I also think the panel-chevron component (drop-down icon) could be positioned to the right instead of below.
Any opinions?

Screen-size of 450px

Screen-size of 320px

Screen-size of 768px

@Mex7180 Mex7180 changed the title [#12279] Instructor home page: Improve display of card header on mobile [#12279] Update: Instructor home page: Improve display of card header on mobile Aug 24, 2023
@Mex7180 Mex7180 changed the title [#12279] Update: Instructor home page: Improve display of card header on mobile [#12279] Instructor home page: Improve display of card header on mobile Aug 25, 2023
@Mex7180
Copy link
Contributor Author

Mex7180 commented Aug 25, 2023

Ready for review :D

@domlimm domlimm self-requested a review August 26, 2023 06:23
@cedricongjh cedricongjh added the s.ToReview The PR is waiting for review(s) label Aug 27, 2023
@jasonqiu212 jasonqiu212 self-requested a review September 1, 2023 18:28
@jasonqiu212
Copy link
Contributor

jasonqiu212 commented Sep 3, 2023

Hi @Mex7180, Thank you for your contribution to the project, and sorry for the late review! Here are my comments:

  1. As mentioned by yourself, I think the dropdown icon can be positioned to the right to remain consistency with the desktop site.
  2. As mentioned by the issue, could you also change the header card itself to be a button element (i.e. Observe that clicking on the card itself toggles the dropdown). Currently, the header card is a <div> element and cannot be picked up by a screen reader. Changing it to a <button> will resolve this issue. Feel free to reference [#12081] Modify question headers for instructor  #12228 on implementing this change!

Thanks!

@jasonqiu212 jasonqiu212 removed the s.ToReview The PR is waiting for review(s) label Sep 3, 2023
@Mex7180
Copy link
Contributor Author

Mex7180 commented Sep 4, 2023

Hi @jasonqiu212, I tried earlier to change the card header to a button element and tried again today. But I keep running into Issues with the Accessibility Tests failing, caused by nested interactivity (Test error: nested-interactive - Ensures interactive controls are not nested as they are not always announced by screen readers or can cause focus problems for assistive technologies (https://dequeuniversity.com/rules/axe/4.6/nested-interactive?application=axeAPI)).
I've found the same issue in this PR #12396. They decided to leave the card header as a div.
I've seen your PR and tried to copy your solution, but it seems like I'm missing something. Have you used any aria-attributes or labels that I might be missing?

PS: The dropdown icon (panel-chevron) is now being displayed on the right.

@nusoss-bot
Copy link

Folks, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢
Hope someone can get it to move forward again soon...

@Mex7180
Copy link
Contributor Author

Mex7180 commented Sep 12, 2023

Hi @jasonqiu212 and @zhaojj2209
I had a look at the PR you send me. It looks like the card header was changed back from a button to a div because of tests failing. I'm running into the same issue with the button element as header because of problems with nested interactive elements (accessibility). The same issue was encountered in this PR #12396.
To your concern about screen-readers not being able to pick up the drop-down-button, I think this could be resolved by changing the panel-chevron component.

My changes

  • change header to be displayed as flex-container
  • change panel-chevron component to be a button and always display on the right

By changing the panel-chevron component to a button it can be selected with the keyboard, has a description and has the aria-expanded attribute to make sure screen readers can also tell if the table-body is being shown or not.

Let me know what you think.

Snapshots:

small window size (mobile):
Bildschirmfoto 2023-09-12 um 11 29 03

big window size (desktop)
Bildschirmfoto 2023-09-12 um 11 29 38

Panel Chevron selected with keys:
Bildschirmfoto 2023-09-12 um 12 30 07

- change to button
- add accessibility attributes
- card-header to div (nested interactivity)
- remove invalid aria-attr.
@Mex7180
Copy link
Contributor Author

Mex7180 commented Sep 12, 2023

Ready for review :D

Copy link
Contributor

@jasonqiu212 jasonqiu212 left a comment

Choose a reason for hiding this comment

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

Hi @Mex7180, Once again I apologize for the late review, and thank you for investigating into this issue!

I took a further look at #12396, and you are correct! My bad, I believe the PR I gave you for reference was merged before the accessibility test was fully included.

While #12396 passed the accessibility test by reverting the button to div, I noticed that the panel dropdown still was not accessible via tabbing and cannot be picked up by the screen reader.

Hence, I think your solution of converting the panel chevron to a button is genius and serves as an alternative to changing the entire header into a button, since:

  • Users can toggle dropdown via tab and screen readers can now pick up the dropdown
  • Passes accessibility test
  • Preserves desktop functionality where entire panel is clickable

Thank you for coming up with this solution :)

There are some nits I would like to raise, because the panel chevron is used in many components. Let's ensure that changing the chevron to a button does not affect the appearance in any of the pages!

@domlimm @cedricongjh Do you think this solution works to improve the accessibility of the dropdown panel? Hoping to look for more opinions on this fix :)

Mex7180 and others added 3 commits September 14, 2023 15:09
- set background color to inherit
- change aria-label
- update snapshots for testing
@jasonqiu212 jasonqiu212 added the s.ToReview The PR is waiting for review(s) label Sep 16, 2023
Copy link
Contributor

@cedricongjh cedricongjh left a comment

Choose a reason for hiding this comment

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

Solution LGTM! (Do look into the removable of the aria label for the rich-text-editor though, as @jasonqiu212 mentioned)

Copy link
Contributor

@jasonqiu212 jasonqiu212 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for contributing to TEAMMATES!

@jasonqiu212 jasonqiu212 added s.FinalReview The PR is ready for final review and removed s.ToReview The PR is waiting for review(s) labels Sep 19, 2023
Copy link
Contributor

@cedricongjh cedricongjh left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for the contribution!

@cedricongjh cedricongjh merged commit b23d47f into TEAMMATES:master Sep 20, 2023
9 checks passed
@wkurniawan07 wkurniawan07 added s.ToMerge The PR is approved by all reviewers including final reviewer; ready for merging c.Feature User-facing feature; can be new feature or enhancement to existing feature and removed s.FinalReview The PR is ready for final review labels Jan 21, 2024
@wkurniawan07 wkurniawan07 added this to the V8.30.0 milestone Jan 21, 2024
@Mex7180 Mex7180 deleted the #12279-mobile-display-course-card-header branch April 15, 2024 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c.Feature User-facing feature; can be new feature or enhancement to existing feature s.ToMerge The PR is approved by all reviewers including final reviewer; ready for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Instructor home page: Improve display of card header on mobile
5 participants