Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A11y: Increase the target area for single-letter index links#103

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
pradyunsg merged 2 commits intopython:mainfromhugovk:accessibilty-index-target-area
Feb 13, 2023

Conversation

hugovk
Copy link
Member

@hugovkhugovk commentedJan 18, 2023
edited
Loading

Fixespython/cpython#101109.

Sphinx auto-generates index pages for entries with.. index::.

At the top of these pages:

It generates a list of links to each index initial letter:

image

However, these links are narrow and have very small clickable target areas, most around 10-15 pixels wide, and "I" is only ~5 pixels wide:

image

They can be hard to click for those with physical issues that make small, precision movements difficult.

WebAIM say:

The danger in using single characters as links—or in using any sort of small link (such as a 10 pixel by 10 pixel graphic)—is that some users will have difficulty clicking on such a small area. Someone with cerebral palsy, for example, may be able to use the hands to manipulate a mouse, but may have difficulty with the precise movements and muscle control necessary to click on a small link. Authors can limit these issues by increasing the size of small links, increasing the font size of single character links, or making the target area larger by including whitespace (such as CSS padding) within small link. Additionally, small adjacent links should have adequate whitespace (such as link CSS margins) between them to minimize users inadvertently clicking the wrong link.

So let's improve accessibility and make:

the target area larger by including whitespace (such as CSS padding) within small link

Here's a demo with this PR:

image

Which gives us a width of around 25-30px for most and ~21px for "I":

image

@@ -230,6 +230,10 @@ dl > dt span ~ em {
padding-left: 20px;
}

div.genindex-jumpbox a {
padding: 0 0.5em;
}
Copy link
Member

Choose a reason for hiding this comment

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

Another option would be to usewidth and/ormin-width, even though that only works on block elements IIRC, so you would have to turn the list into a flexbox.
The advantage of doing this is that the target box and the distance between the|s will be the same for all letters, and that the list will stay relatively compact.

You could even try to use negative margins to expand the clickable area on the space characters between the|s and the letters, but for accessibility purposes there should be enough space between a link target and the other, so it's probably not worth messing with negative margins.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Good idea! Updated and rebuilt the demo:

image

https://hugovk-cpython.readthedocs.io/en/accessibilty-index-target-area/genindex.html

image

https://hugovk-cpython.readthedocs.io/en/accessibilty-index-target-area/genindex-all.html

Applied the flexbox container to two places here:

div.genindex-jumpbox,div.genindex-jumpbox>p {display: inline-flex;flex-wrap: wrap;}

Because the structure is slightly different on the two pages.

The first is:

<divclass="genindex-jumpbox"><p> [all the A-Z links]</p><p> [full index link]</p></div>

The second is:

<divclass="genindex-jumpbox"> [all the A-Z links]</div>
HTML details
<divclass="genindex-jumpbox"><p><ahref="genindex-Symbols.html"><strong>Symbols</strong></a>     |<ahref="genindex-_.html"><strong>_</strong></a>     |<ahref="genindex-A.html"><strong>A</strong></a>     |<ahref="genindex-B.html"><strong>B</strong></a>     |<ahref="genindex-C.html"><strong>C</strong></a>     |<ahref="genindex-D.html"><strong>D</strong></a>     |<ahref="genindex-E.html"><strong>E</strong></a>     |<ahref="genindex-F.html"><strong>F</strong></a>     |<ahref="genindex-G.html"><strong>G</strong></a>     |<ahref="genindex-H.html"><strong>H</strong></a>     |<ahref="genindex-I.html"><strong>I</strong></a>     |<ahref="genindex-J.html"><strong>J</strong></a>     |<ahref="genindex-K.html"><strong>K</strong></a>     |<ahref="genindex-L.html"><strong>L</strong></a>     |<ahref="genindex-M.html"><strong>M</strong></a>     |<ahref="genindex-N.html"><strong>N</strong></a>     |<ahref="genindex-O.html"><strong>O</strong></a>     |<ahref="genindex-P.html"><strong>P</strong></a>     |<ahref="genindex-Q.html"><strong>Q</strong></a>     |<ahref="genindex-R.html"><strong>R</strong></a>     |<ahref="genindex-S.html"><strong>S</strong></a>     |<ahref="genindex-T.html"><strong>T</strong></a>     |<ahref="genindex-U.html"><strong>U</strong></a>     |<ahref="genindex-V.html"><strong>V</strong></a>     |<ahref="genindex-W.html"><strong>W</strong></a>     |<ahref="genindex-X.html"><strong>X</strong></a>     |<ahref="genindex-Y.html"><strong>Y</strong></a>     |<ahref="genindex-Z.html"><strong>Z</strong></a></p><p><ahref="genindex-all.html"><strong>Full index on one page</strong>                                               (can be huge)</a></p></div>
<divclass="genindex-jumpbox"><ahref="#Symbols"><strong>Symbols</strong></a> |<ahref="#_"><strong>_</strong></a> |<ahref="#A"><strong>A</strong></a> |<ahref="#B"><strong>B</strong></a> |<ahref="#C"><strong>C</strong></a> |<ahref="#D"><strong>D</strong></a> |<ahref="#E"><strong>E</strong></a> |<ahref="#F"><strong>F</strong></a> |<ahref="#G"><strong>G</strong></a> |<ahref="#H"><strong>H</strong></a> |<ahref="#I"><strong>I</strong></a> |<ahref="#J"><strong>J</strong></a> |<ahref="#K"><strong>K</strong></a> |<ahref="#L"><strong>L</strong></a> |<ahref="#M"><strong>M</strong></a> |<ahref="#N"><strong>N</strong></a> |<ahref="#O"><strong>O</strong></a> |<ahref="#P"><strong>P</strong></a> |<ahref="#Q"><strong>Q</strong></a> |<ahref="#R"><strong>R</strong></a> |<ahref="#S"><strong>S</strong></a> |<ahref="#T"><strong>T</strong></a> |<ahref="#U"><strong>U</strong></a> |<ahref="#V"><strong>V</strong></a> |<ahref="#W"><strong>W</strong></a> |<ahref="#X"><strong>X</strong></a> |<ahref="#Y"><strong>Y</strong></a> |<ahref="#Z"><strong>Z</strong></a></div>

ezio-melotti reacted with hooray emoji
@hugovkhugovkforce-pushed theaccessibilty-index-target-area branch 2 times, most recently from17690a2 to574eb98CompareJanuary 18, 2023 19:59
@hugovkhugovkforce-pushed theaccessibilty-index-target-area branch from574eb98 to75b8026CompareFebruary 13, 2023 11:27
@hugovk
Copy link
MemberAuthor

@pradyunsgpradyunsg merged commit73f08ce intopython:mainFeb 13, 2023
@hugovkhugovk deleted the accessibilty-index-target-area branchFebruary 13, 2023 12:02
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ezio-melottiezio-melottiezio-melotti left review comments

@pradyunsgpradyunsgpradyunsg approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

HTML documentation has accessibility issues for movement-impaired developers
3 participants
@hugovk@pradyunsg@ezio-melotti

[8]ページ先頭

©2009-2025 Movatter.jp