-
Notifications
You must be signed in to change notification settings - Fork 9
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
120 Skiplinks #303
120 Skiplinks #303
Conversation
Questions:
|
@@ -0,0 +1,7 @@ | |||
<header> | |||
<a href="#main-content" class="su-skiplinks">{{ text|default('Skip to content') }}</a> |
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.
Id's are hard and don't really belong in a pattern library. There is no way to ensure that the next developer's software doesn't or does have a main-content id. Unfortunately, for this functionality, we need one. I would suggest opening up the anchor link to a twig variable and perhaps generate a random id if one is not provided.
Example not tested*
{% set skipID = "skip-to-content-" ~ random() %
<a href="{{ anchor|default(skipID) }}" class="su-skiplinks">{{ text|default('Skip to content') }}</a>
I am not sure. I wouldn't want it to be behind anything so, yes? As this is likely above the brand bar perhaps something higher than that component?
My vote is yes, out with the old, in with the new. |
For the skiplink component itself, I'm totally fine with just using a class .su-skiplink. I believe some sites have multiple skiplinks, eg, one link to content and one to footer, then in that case, it makes even more sense to just use a class.
Like @sherakama , I do like the skiplinks to be above everything else when it comes into view. I think somewhere in my nav I set something to z-index: 22222 so any number larger than that is probably good 😂
Yes, I'm totally ok with having just the new skiplink component and drop the old one. It would be nice to be able to pass href variable though. I do have a question about the twig template. Is it more for demo purposes rather than something that developer will actually pull into their site template? I imagine that the skiplink mixin is easier to use since it doesn't add the header and main sections. Thanks for working on this, @josephgknox! This is so much better than the old one 👍 |
Thank you both for the feedback. I will continue working to implement some of the above, as well as clean up the old Skipnav component. @yvonnetangsu good question. More so for demo purposes, as I wanted it to be testable in some way via the pattern library. I, too, think that a developer would use the mixin/class/ID/etc. as they wish, leveraging the functionality more than the template. |
@josephgknox, for the component itself, have a usable template that could be embedded directly. If you need to show it as an example in the styleguide, create a new template or use straight up markup to change the rendered output example. |
@josephgknox - Great! That makes sense. In that case, would it be helpful to add some wording to explain how one can test the demo in the component section since it's not visible until they start tabbing? Before I started working here, I wasn't familiar with skiplinks and wouldn't know to use the tab key 😂 so perhaps a short explanation would help developers who are new to this. |
@sherakama @yvonnetangsu can you two have another review? We closer? |
Yes, definitely closer! A few suggestions - please feel free to push back.
|
width: auto; | ||
z-index: 9999; | ||
} | ||
} |
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.
Why doesn't this extend the helper classes, .su-sr-only-element
or .su-sr-only-text
, or include the mixins, hide-visually
, hide-text
?
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.
It can. The approach here, though, is a little bit different than that of what those two mixins (or related classes) do. I used Homesite as an example of an approach and aimed to mirror that implementation, which only "hides" something from print, but does not leverage nor extend the Bourbon mixins (hiding the element or the text).
While @include hide-visually;
and @include hide-visually("unhide");
for hover and focus states might get us something similar as far as behavior, it would be a slight shift from what Homesite is doing, I believe.
Related: I noticed that Homesite had a _placeholders.scss
file that has a primary purpose of being available for extended code. If we do want to use extends here (or in the future), we might want to consider doing something similar.
https://code.stanford.edu/ucomm/homesite-2017/blob/master/wp-content/themes/homesite17/scss/base/_placeholders.scss
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.
Do you know specifically what would be different if we used hide-visually
? Is it the animation of having the skip links drop down from top:-500px
?
I'm ok with this as is. I was just curious why we're not using the utilities that were updated as part of this PR.
For identity and homesite, Kevin set up a single separate file that manages all explicit z-indexes for All The Things. I've found it extremely helpful to be able to go to just one place and see the relative "heights" of various elements. I heartily suggest doing that in Decanter. I think it would make it much easier for people building on top of Decanter to find the stack order in a single location so they could know definitely where they need to stick their stuff to show up at the right level. |
That does sound like a good idea. I wonder what's the best way to do this for Decanter. Maybe have the z-indexes in a variable map and pull the value for each component as needed? |
@yvonnetangsu thanks! I will update the default |
I also like this idea! Do we want to break this out into another task? Or, do we want to complete something as part of this task/PR? |
Thanks for the fixes! And I vote for breaking this into another task so we can merge this in faster. |
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.
Looks GTG to me! 👍
I've created issue #305 to capture this task. Let's not let scope-creep delay merging the good work you've already done. |
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.
Thanks for making the changes I requested. And thanks for your great work in general. This looks good to go!
@@ -0,0 +1,9 @@ | |||
{% set skipID = "skip-to-content-" ~ random() %} | |||
|
|||
<header> |
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.
Do we need a wrapper around this? Isn't the idea that this link be placed as the first element after the body tag? If that is so, I would recommend removing or changing the <header>
tag as to not compete with other header elements right after the body tag.
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.
Thanks - this has been removed.
{% set skipID = "skip-to-content-" ~ random() %} | ||
|
||
<header> | ||
<a href="#{{ target_id|default(skipID) }}" class="su-skiplinks">{{ link_text|default('Skip to main content') }}</a> |
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.
Missing modifier class.
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.
Missing attributes
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.
Added.
<a href="#{{ target_id|default(skipID) }}" class="su-skiplinks">{{ link_text|default('Skip to main content') }}</a> | ||
</header> | ||
|
||
<main> |
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.
Do we need to have the target in this template file? It won't be directly usable if this main markup is here. I am assuming this is an example. I would like to see a directly usable option as well as the demo.
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.
@sherakama is your recommendation that the twig template only include the following?
{% set skipID = "skip-to-content-" ~ random() %}
<a{{ attributes }} href="#{{ target_id|default(skipID) }}" class="su-skiplinks {{ modifier_class }}">{{ link_text|default('Skip to main content') }}</a>
And, then, perhaps add example markup directly to the SCSS file, something like:
Markup: <a href="#main-content" class="su-skiplinks ">Skip to main content</a><main><h2 id="main-content" class="su-sr-only-text" tabindex="-1">Main Content</h2></main>
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 think skiplinks are a special snowflake. They are, by definition, not self-contained. I don't believe there's anyway to get them to work with a single twig file.
Since they'll require the user to create custom markup anyway, I vote for having all the necessary pieces in our .twig
file, and document how users need to use each piece. I would therefore vote for restoring the <header>
wrapper around the link itself, since it demonstrates the recommended placement for the link.
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.
Some feedback around the twig template.
I also like the idea of the z-index file.
* 120-skiplinks-b: Alternative render.
@yvonnetangsu @JBCSU @sherakama I think this is now ready for a final review and/or further discussion on any of the recent comments and changes. |
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.
GTG
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.
Missing a "c" otherwise GTG! Thank you for the great work and adding the documentation 😄
Co-Authored-By: josephgknox <[email protected]>
#303 more comments here. |
* 120-skiplinks-b: Alternative render.
Three green checkboxes. Merging. |
* master: 120 Skiplinks (#303)
// </header> | ||
// <main> | ||
// <h2 id="main-content" class="su-sr-only-text" tabindex="-1">Main Content</h2> | ||
// </main> |
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.
@sherakama Hardcoding the markup here means the styleguide doesn't use our twig templates. In the other branch I refactored the twig files specifically so that the styleguide could use the roll-up skiplinks.twig
file, which evaluates to essentially this hardcoded markup, while coding the individual elements separately (link.twig
& target.twig
) files so site builders could place the elements appropriately in their sites' markup. So is there still a reason to hardcode the markup here? I think having the styleguide use skiplinks.twig
, which in turn uses the twig files we're recommending site builders use, is preferable.
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 was trying to find a way to balance effort, documentation, and keeping the twig templates directly usable vs an example.
- This was a fast (lazy) way to create the correct output in the styleguide
- Maintained a usable twig file.
I'd prefer to avoid having twig files merely to generate styleguide output as we can do that in the markup and to keep the intent of the twig files as something that an author can/should/could use directly in their project.
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.
The style guide is how I test the twig files. If they're not actually used in the style guide, how do I know they work? I don't want to have to wait until I build a site on top of decanter to find out there's a problem with the templates.
* master: Add linear gradient background mixin (#304) Tweaking modular-spacing mixin to be more user friendly (#309) 120 Skiplinks (#303) 72 main nav (#264) Update _input.scss (#301) Update README.md (#302) 298-change "sticky-footer" mixin to target <footer> selector (#299) Set base font size for each breakpoint (#295) doc: add period (#294) 151 global footer tweaks (#293) Small bugfix for mobile. (#291) 282: Fix modular-spacing mixins and variables (#290) # Conflicts: # core/js/decanter.js - moved code into core/js/components/main-nav/main-nav.js
READY FOR REVIEW
Summary
Needed By (Date)
Urgency
Steps to Test
grunt styleguide
Note: the
z-index
of the brand bar and the Decanter header in the KSS style guide overlay the "Skip to content" button link that slides into view on :focus. Those indexes might need to be temporarily disabled (in inspector) to test this fully.Affected Projects or Products
Associated Issues and/or People
See Also