question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Page chooser should use buttons instead of links with invalid targets

See original GitHub issue

Issue Summary

In the page chooser, the explorer view allowing users to select a page uses links (<a>) to allow users to select a page:

<a class="choose-page" href="#3" data-id="3" data-title="Breads" data-url="http://127.0.0.1:8000/breads/" data-parent-id="60" data-edit-url="/admin/pages/3/edit/">Breads</a>

There are three problems with this:

  • Using <a> tags instead of buttons. For screen reader users, this UI will be announced as if it was a list of links for the user to navigate to those pages, not as a button to select the page. For example with VoiceOver, this would be announced as “link, Breads”. We instead want “button, Select ‘Breads’ page” (or similar).
  • Related to the above – the page title “Breads” isn’t enough context to understand what the control is for.
  • Using page id as an href. This is problematic for accessibility testing tools, which will flag this as broken markup, since there is no element with that fragment identifier on the current page.

Steps to Reproduce

  1. Go to the CMS admin using screen-reader software
  2. Open a page/link chooser
  • I have confirmed that this issue can be reproduced as described on a fresh Wagtail project: no

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
cfarmcommented, Jul 26, 2019

Additionally I would recommend not highlighting the whole row in this interface, since the whole row is not a clickable/interactive element

0reactions
lb-commented, Sep 16, 2022

PR up for fixing this https://github.com/wagtail/wagtail/pull/9209 (note: the simplest fix, does not solve the problem of hover states for these, that will be a much bigger job and require a change of DOM structure that will add a lot of complexity).

If that PR goes through we will split this issue to a more suitable one for possibly changing the chooser approach to have an explicit ‘select’ button I think but that needs a larger decision.

Hopefully the PR fixes the core problem now and gives us a reference to also fix the same issue in other chooser listings.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stop using anchors as buttons! | Ancestry Corporate
Semantic buttons and links are important for usability as well as accessibility. Hyperlinks indicate a URL change, whereas buttons are used to perform...
Read more >
A Complete Guide to Links and Buttons - CSS-Tricks
Our complete guide to links, buttons, and button-like inputs in HTML, CSS, and JavaScript.
Read more >
Custom Button and Link Fields - Salesforce Help
Salesforce checks the correctness of URLs in custom links and custom buttons. When you create or edit custom links or buttons that contain...
Read more >
HTML Button Link Code Examples – How to Make HTML ...
In this article, we are going to explore three different ways you can make an HTML button act like a link.
Read more >
Designing for Action: Best Practices for Effective Buttons
That primary Sign Up button is there to direct all the new visitors to the site. 3. Buttons are not links. Links do...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found