-
-
Notifications
You must be signed in to change notification settings - Fork 873
Conversation
👍 Good call |
👍 |
We should have a designer talk on accessibility some Friday. |
This has some applicability, such as 'skip to content' actions e.g. 'tabbing' on the gov.uk site. Perhaps that means there's a case for a Have you considered using |
@LkeMitchll Great points; thanks! So, |
Yea, exactly. It saves having to build some JS or resorting to using Although if you think there's a better name for it that might be good. 'Unhide' feels a little weird. Not sure. |
@tysongach The |
@corwinharrell Ah, yes! Thanks for bringing that up. I looked into it, but failed to mention that in my original PR comment.
We could add another line to the mixin, to also include @mixin hide-visually {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
clip-path: circle(1px at 1px 1px); // add this
height: 1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
} |
👍 to @LkeMitchll for a show-on-focus mixin to complement this (especially for skip to content links). |
04df015
to
727e21b
Compare
Okay! So, I added Regarding “un-hiding” content on
Personally, I like Option 2 because it means we don’t have to maintain two mixins which are highly connected to each other (one “undoes” the other’s styles). I also think Option 2 is generally gives more awareness to what is going on (again, one “undoes” the hiding). I also purposely didn’t bake the I went ahead and pushed Option 2 here to this PR, but I’m happy to have a discussion and hear people’s thoughts! |
185b35e
to
0cc51ee
Compare
@if $toggle == "hide" { | ||
border: 0; | ||
clip: rect(1px, 1px, 1px, 1px); | ||
clip-path: circle(1px at 1px 1px); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a specific reason that you're using rect()
for older browsers and circle()
for newer ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LkeMitchll The variation between the two annoyed me (ha!), but it’s because clip
only accepts rect()
, and clip-path
doesn’t even have rect()
as an available value. clip-path
accepts a handful of values, which you can find here: https://developer.mozilla.org/en-US/docs/Web/CSS/clip-path#Syntax
I was actually speaking with @georgebrock just last night about swapping this for a polygon()
is it can do a single x
/y
pair as the value. I’m gonna test that now…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tysongach Thanks for the heads up on that. That's a strangely awkward syntax. You're right polygon()
seems to be closest to the rect()
syntax.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely…
So, using clip-path
’s polygon()
to achieve the same thing as the old clip
property would look like this:
clip-path: polygon(0 0, 1px 0, 1px 1px, 0 1px);
http://codepen.io/tysongach/pen/bEvLEY
I think I prefer the terseness of circle()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m now wondering if we should use percentages rather than pixels in the clip-path
, though:
clip-path: circle(1% at 1% 1%);
Because currently, we are clipping down to 1px, and since the height
and width
are also set to 1px
, the end result will always be a box with the dimensions of 1px
by 1px
.
If we use percentages for the clipping, it would clip 1/100th of the 1px
box, therefore hiding more.
This all begs the question, where did the 1px
values come from originally? I also assume we can’t do zero values because of some reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to this (see bottom of article) It's because if the element was 0px it would not be detected by VoiceOver (and presumably other speech services). But I don't see why using a percentage would hurt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that makes sense. Same reason they don’t pick up display: none;
…
Thanks!
@tysongach I agree on option 2, plus it appears to follow a similar convention to |
67ea7d5
to
5c575c3
Compare
029805c
to
802f690
Compare
Hides an element visually while still allowing the content to be accessible to assistive technology, e.g. screen readers
802f690
to
98f9473
Compare
Hides an element visually while still allowing the content to be accessible to assistive technology.
A great use-case is one I recently came across on Administrate: thoughtbot/administrate#416