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

Fix link button focus targets #18007

Closed
wants to merge 7 commits into from
Closed

Fix link button focus targets #18007

wants to merge 7 commits into from

Conversation

filiptronicek
Copy link
Member

@filiptronicek filiptronicek commented Jun 21, 2023

Description

Sometimes, we use buttons for actions which cause navigation (i.e. links). We shouldn't do that - it's both against the HTML recommendations as well as generally inaccessible. This PR reuses our <Button> component and adds the href prop for creating a link instead of a standard HTML button, with the same visuals.

The tl;dr is that when you move around elements with the keyboard, the new workspace button is not made out of two focus targets anymore. The old behavior is visible below:
Recording 2023-06-21 at 21 38 57

Related Issue(s)

Partially addresses #16724

Documentation

Preview status

Gitpod was successfully deployed to your preview environment.

Build Options

Build
  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer
  • analytics=segment
  • with-dedicated-emulation
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated
Preview Environment
  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh

/hold

@filiptronicek
Copy link
Member Author

With regards to the preview environment failing, I will try to re-trigger tomorrow. It looks like something's up

return (
<button
type={htmlType}
ref={ref as ForwardedRef<HTMLButtonElement>}
Copy link
Member

@svenefftinge svenefftinge Jun 26, 2023

Choose a reason for hiding this comment

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

do you want to handle ref being an anchor element differently?

Copy link
Member Author

@filiptronicek filiptronicek Sep 14, 2023

Choose a reason for hiding this comment

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

Nope, this was an oversight and I've now put it on the link as well... thanks for catching it

Copy link
Contributor

@gtsiolis gtsiolis left a comment

Choose a reason for hiding this comment

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

Thanks for opening this and #16724, @filiptronicek. 🌮

Links are for navigation. Buttons are for everything else.
We should avoid mixing these when possible.

Alternatively, having a button component variant that can visually style an action like an anchor link when using a plain link isn't possible, sounds great. ✔️

@geropl geropl added team: team-experience and removed team: webapp Issue belongs to the WebApp team labels Jul 26, 2023
@stale
Copy link

stale bot commented Aug 11, 2023

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale This issue/PR is stale and will be closed soon label Aug 11, 2023
@filiptronicek filiptronicek requested a review from a team as a code owner September 14, 2023 15:00
@stale stale bot removed meta: stale This issue/PR is stale and will be closed soon labels Sep 14, 2023
@filiptronicek filiptronicek marked this pull request as draft September 19, 2023 07:12
@stale
Copy link

stale bot commented Oct 15, 2023

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale This issue/PR is stale and will be closed soon label Oct 15, 2023
@filiptronicek
Copy link
Member Author

Work continues in #19012

@filiptronicek filiptronicek deleted the ft/focus-targets branch January 24, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants