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

Shortlist button focusable #5228

Merged
merged 1 commit into from
Nov 4, 2024
Merged

Conversation

lucascumsille
Copy link
Contributor

@lucascumsille lucascumsille commented Oct 23, 2024

Bug found while working on this PR: #5208

This PR changes the markup of label.btn--shortlist and swaps it for button.btn--shortlist, that way the element is focusable and can also be interacted via keyboard.

[Skip changelog]

Copy link

codecov bot commented Oct 23, 2024

Codecov Report

Attention: Patch coverage is 0% with 13 lines in your changes missing coverage. Please review.

Project coverage is 82.41%. Comparing base (bd545ee) to head (a6ebf9a).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
web/cobrands/fixmystreet/fixmystreet.js 0.00% 13 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5228   +/-   ##
=======================================
  Coverage   82.40%   82.41%           
=======================================
  Files         409      409           
  Lines       32041    32042    +1     
  Branches     5109     5109           
=======================================
+ Hits        26403    26406    +3     
+ Misses       4125     4123    -2     
  Partials     1513     1513           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@dracos dracos left a comment

Choose a reason for hiding this comment

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

This works, but I wonder if there's an easier solution - if we switch this label to be an actual button with form="planned_form" (and adjustments accordingly) then I don't think the submit button in the planned_form is even needed - perhaps whoever did this originally didn't know buttons in a form can actually be linked to a different form?

@lucascumsille lucascumsille force-pushed the shortlist-button-focusable branch 2 times, most recently from e5c3b4c to f279d21 Compare October 23, 2024 13:49
@lucascumsille
Copy link
Contributor Author

lucascumsille commented Oct 23, 2024

This works, but I wonder if there's an easier solution - if we switch this label to be an actual button with form="planned_form" (and adjustments accordingly) then I don't think the submit button in the planned_form is even needed - perhaps whoever did this originally didn't know buttons in a form can actually be linked to a different form?

Thanks for the feedback, I thought there would be a more powerful reason to use input and label. So I swapped it for a button and it seems to be working =)

Screen.Recording.2024-10-23.at.15.11.49.mov

Copy link
Member

@dracos dracos 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 apart from one removal

web/cobrands/fixmystreet/fixmystreet.js Show resolved Hide resolved
Copy link
Member

@dracos dracos left a comment

Choose a reason for hiding this comment

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

Great :)

This fix allows users using keyboards to be able to focus the label.btn--shortlist element to shortlist a report.
@lucascumsille lucascumsille merged commit a6ebf9a into master Nov 4, 2024
20 of 22 checks passed
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.

2 participants