-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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 Bug: .visuallyhidden on macOS VO #1986
Conversation
This PR solves [issue 1985: macOS - VoiceOver / Chrome announcing visually hidden text out of order](https://github.com/h5bp/html5-boilerplate/issues/1985) By removing the negative margin, and setting it to `margin: 0;`, the issue is resolved.
@scottaohara arg! I'm able to replicate the reading order bug with a This makes a bit of sense as to why my initial 'fix' helped as it kept the text inline. It seems like if the text falls outside of some little box the browser is making for the type it affects reading order. I'm continuing testing on this today. Check out this pen -- if you move the |
well this is incredibly frustrating. i'll spend some time hammering on this as well also, it's not working for me w/the line-height below 1.3? |
OK, @joe-watkins Here's the markup I've been using (based on your markup, with extra text appearing after the VH-text) <a href="/some-cool-page" target="_blank">
I am a link with visually hidden text<span class="visuallyhidden2">,
opens in a new window</span> more content to come after v.h.text
</a> I've been able to modify the ruleset in the following ways to correct the reading order:
Additionally, I found no issues with reading order when the original visually hidden text class was used with non-interactive text (e.g. paragraphs, lists and a heading, as in the above screen shot) So those are the 'fixes' I've identified for now....personally I'm partial to number 3, but think number 1 would require the least amount of effort. Thanks for continuing to test this, Joe. |
With the current CSS I also noticed that in Safari the focus ring appears a bit out-of-whack.. you can 'see' the visually hidden text in a way. Oddly, I've had some success by adding Adding @scottaohara I'm partial to #3 as well but feel like defining a percentage to anything may be brittle in certain scenarios.. who knows. I'm more partial to my original recommendation to setting the positioning to relative, which will allow for text to be anywhere in the content, and display of inline block. I can't get this to break! .visuallyhidden {
border: 0;
clip: rect(0 0 0 0);
clip-path: inset(50%);
display: inline-block; /* new */
height: 1px;
margin: 0;
overflow: hidden;
padding: 0;
position: relative; /* relative instead of absolute */
width: 1px;
white-space: nowrap; /* 1 */
} Code demo: |
@joe-watkins the original demo also has a break in an underline if you include additional text after the subtle, but it'll drive all those 'pixel perfect' perfectionists crazy ;) shrug....maybe it's not that big of a deal for the break to be there? i'm more interested in the text reading correctly than i am with the link underline staying fully intact. i guess another question to ask, is this actually a VO bug? |
@scottaohara Ha! Adding the old negative .visuallyhidden {
border: 0;
clip: rect(0 0 0 0);
clip-path: inset(50%);
display: inline-block; /* new */
height: 1px;
margin: -1px; /* back to life */
overflow: hidden;
padding: 0;
position: relative; /* relative instead of absolute */
width: 1px;
white-space: nowrap; /* 1 */
} I've been testing this pen with good results. I don't have an IE7/6 VM but holds up in 8/9 visually and JAWS/NVDA/VO doing well with modern browsers. https://codepen.io/joe-watkins/pen/rzGrWX Insert Family Guy CSS meme here :) |
nice @joe-watkins. not going to lie, i feel pretty silly right now since we're mostly back to your original suggestion. sorry to send us in a circle :( I just tested your codepen link and saw that |
@scottaohara Ha good catch.. copy/paste craziness got me there. You are correct,.. removing the No worries with driving in circles -- that's all web development is :) This leaves us with: .visuallyhidden {
border: 0;
clip: rect(0 0 0 0);
clip-path: inset(50%);
display: inline-block;
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
width: 1px;
white-space: nowrap; /* 1 */
} I'll plop this into a couple projects and see if I can break something. |
nice work @joe-watkins :) |
@scottaohara tnx! you too! Looks like this new CSS also works with I'll take our findings back to the main issue to get more thoughts ;) |
There is no point in using |
@tomasz1986 tnx! I wondered about that. I guess in super old browsers visually things may break w/out any targeting. |
It is not really about super old browsers. http://caniuse.com/css-clip-path On the other hand, |
This PR solves [issue 1985: macOS - VoiceOver / Chrome announcing visually hidden text out of order](https://github.com/h5bp/html5-boilerplate/issues/1985) By removing the negative margin, and setting it to `margin: 0;`, the issue is resolved.
This PR solves issue 1985: macOS - VoiceOver / Chrome announcing visually hidden text out of order
By removing the negative margin, and setting it to
margin: 0;
, the issue is resolved.Types of changes
Checklist: