Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
SplitPageLayout API #2144
SplitPageLayout API #2144
Changes from 1 commit
6117622
c5c53a5
a9c7353
96edc7a
64d76df
2578d2e
6e60bdf
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
nit: I generally prefer optional boolean attributes to be true instead of false, especially when the default is visible=true:
<SplitPageLayout.Pane hidden={{narrow: true}}>
"visible: no, not visible" vs "hidden: yes, hidden"
bonus points for matching/extending the HTML attribute hidden https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden
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 like
hidden
👍 (especially because it aligns with an existing HTML attribute). @vdepizzol @jonrohan how do you feel about usinghidden
instead ofvisible
?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 there was push back because it matched html spec. In the PVC case
hidden: true
would end up being attributes on the html 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.
Is there a reason we don't want the attribute to end up on the HTML tag? Seems like it would be semantically correct:
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 also prefer
hidden
, but like @jonrohan mentioned, there's a big confusion in the way PVC is designed, since it handles element attributes and component properties the same way.Through
system_arguments
, a booleanhidden
HTML attribute can be passed to any PVC already. Since the visibility prop also needs to accept responsive values (narrow/regular/wide), and doesn't manipulate the hidden attribute directly, we tried to find an alternative.If you folks think this is not a problem, I'm happy to use
hidden
instead. I'd just like to make sure the API is the same across PRC and PVC.@jonrohan what do you think about dropping support for
system_arguments
in PageLayout and SplitPageLayout? We definitely don't want any of those utilities applied, and I can't think of any custom HTML attribute being useful there (maybedata-*
?)c/c @joelhawksley
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.
@jonrohan yes please <3
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.
@vdepizzol I'm not familiar with the
hidden
property as I've only ever used/recommendeddisplay: none
. I'm cc'ing @primer/accessibility-reviewers on this one.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 not sure I'm fully grokking what you're asking here so apologies in advance if I don't answer your question correctly 😅
To hide an element visually but still allow the screen reader to access it, we style it so that it appears off the page (e.g.
<h1 class="sr-only">A heading which a screen reader will read</h1>
will achieve this).However, if you try to apply this on any content which contains focusable elements (buttons, and other form elements) this causes confusion for sighted users who navigate via keyboard since the elements will gain keyboard focus but the user won't be able to see the element that's focused.
In the case of panels that could contain focusable elements, you'd have to hide this from all users to avoid confusion since it's most likely that there will be focusable elements within the panel. I would advise using
display: none
on a css class for this since that seems to be the pattern we use and recommend elsewhere.As a slight aside, I would also recommend when you're building a prototype for this component that it's tested early with a high zoom to ensure that developers who use high zoom don't find panels removed unnecessarily.
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.
Thank y'all for weighing in. Based on everyone's input so far, I'm going to move forward with the
hidden
prop for this API draft. It seems like we agree that calling the prophidden
is better thanvisible
from a component API perspective, but we still need to figure out the implementation details. We can discuss those details in future PRs.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.
Chiming in a bit late here, but I'd like to consider using something besides
hidden
. I think we need to be careful of overloading terms in our glossary, andhidden
is also an HTML attribute.While I do generally agree that having system arguments coexist with HTML attributes, in this case I think it's actually a good thing! IMO we should be leaving room for HTML to supercede our component systems as it it ultimately the underlying technology we're building on.
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.
yay! makes so much sense
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.
ResponsiveValue<>
is a little cryptic. Should we explicitly write out the object?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.
Agreed.
ResponsiveValue<>
doesn't explain much. The full type signature looks like this:Do you think it'd be overwhelming to show the whole thing?
My original plan was to add a separate documentation page about responsive props that explains what
ResponsiveValue<>
means and link to it from here.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.
Should this be called "maxWidth" if it's the maximum width of the content area?
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.
That makes sense to me. We'd need to update this in PageLayout as well. @vdepizzol @jonrohan How you feel about
width
->maxWidth
?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 it should remain as
width
. As a prop, it's a characteristic of the region, not a reference to the CSS attribute. Responsive components are expected to adjust on smaller viewport sizes anyway.