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

keyboard navigation for cluster badge appearance modal #13021

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

aalves08
Copy link
Member

@aalves08 aalves08 commented Jan 9, 2025

Summary

Fixes #12781

Occurred changes and/or fixed issues

  • Fix keyboard navigation for cluster explorer view
  • Fix keyboard navigation for cluster appearance modal
  • add focus-trap directive
  • update card component to have a focus-trap trigger, controlled via prop, so that it applies a focus-trap to be used in modals
  • add missing role, label, aria's to elements
  • make checkbox tooltip browsable/triggerable via keyboard nav
  • improve keyboard controls for input type=colorinput

Technical notes summary

  • We can't implement a focus trap directly on the appModal because of the nature of teleport mechanism
  • for now, focus-trap directive is not being used directly. I think we will use it in the future where the implementation mechanisms are simpler to handle that the advanced teleport cases of modals

Areas or cases that should be tested

Areas which could experience regressions

Screenshot/Video

Screen.Recording.2025-01-13.at.14.02.38.mov

Checklist

  • The PR is linked to an issue and the linked issue has a Milestone, or no issue is needed
  • The PR has a Milestone
  • The PR template has been filled out
  • The PR has been self reviewed
  • The PR has a reviewer assigned
  • The PR has automated tests or clear instructions for manual tests and the linked issue has appropriate QA labels, or tests are not needed
  • The PR has reviewed with UX and tested in light and dark mode, or there are no UX changes

@aalves08 aalves08 self-assigned this Jan 9, 2025
@aalves08 aalves08 force-pushed the 12781-cluster-badge-config-key-nav branch from e671c29 to f1f73c5 Compare January 13, 2025 14:10
@aalves08 aalves08 added this to the v2.11.0 milestone Jan 13, 2025
@aalves08 aalves08 requested a review from rak-phillip January 13, 2025 14:26
@aalves08 aalves08 marked this pull request as ready for review January 13, 2025 14:27
@aalves08 aalves08 changed the title WIP: keyboard navigation for cluster badge appearance modal keyboard navigation for cluster badge appearance modal Jan 13, 2025
shell/initialize/install-directives.js Outdated Show resolved Hide resolved
shell/components/form/ColorInput.vue Outdated Show resolved Hide resolved
@aalves08 aalves08 requested a review from rak-phillip January 15, 2025 16:04
@@ -90,6 +90,7 @@
"express": "4.17.1",
"file-saver": "2.0.2",
"floating-vue": "5.2.2",
"focus-trap": "^7.6.2",
Copy link
Member

Choose a reason for hiding this comment

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

Can we pin focus-trap to the version being used?

@@ -90,6 +90,7 @@
"express": "4.17.1",
"file-saver": "2.0.2",
"floating-vue": "5.2.2",
"focus-trap": "^7.6.4",
Copy link
Member

Choose a reason for hiding this comment

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

Same here - pin focus-trap to the version that we want to target.

@@ -16,26 +16,31 @@ export default {
}
},
methods: {
customBadgeDialog() {
customBadgeDialog(ev) {
Copy link
Member

Choose a reason for hiding this comment

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

ev looks like an unused parameter that can be omitted.

@click="customBadgeDialog"
@keyup.space="customBadgeDialog"
Copy link
Member

Choose a reason for hiding this comment

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

Does a button require explicitly listening for space? iirc space/enter should trigger a click event in buttons.

Comment on lines 644 to 650
<a
role="button"
:aria-label="displayProvider"
@click="goToHarvesterCluster"
@keyup.space="goToHarvesterCluster"
@keyup.enter="goToHarvesterCluster"
>
Copy link
Member

Choose a reason for hiding this comment

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

Do we get any benefit out of preserving the anchor element? I still think that it makes more sense to use a button in these cases, we can use <button class="btn role-link" and that should produce a similar effect.

Comment on lines +144 to +145
# this is the "same" as doing a yarn dev (in a build sense)
# it's to make sure the dev environment is running properly
Copy link
Member

Choose a reason for hiding this comment

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

Is this comment meant for a different PR?

Comment on lines +59 to +78
data() {
return { focusTrapInstance: {} as FocusTrap };
},
mounted() {
if (this.triggerFocusTrap) {
this.focusTrapInstance = createFocusTrap(this.$refs.cardContainer as HTMLElement, {
escapeDeactivates: true,
allowOutsideClick: true,
});

this.$nextTick(() => {
this.focusTrapInstance.activate();
});
}
},
beforeUnmount() {
if (this.focusTrapInstance && this.triggerFocusTrap) {
this.focusTrapInstance.deactivate();
}
},
Copy link
Member

Choose a reason for hiding this comment

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

I have a hunch that this is something that we can reuse across different components. Have we considered if this would fit into a composable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

a11y: Fix keyboard navigation and focus display for cluster appearance configuration
2 participants