-
Notifications
You must be signed in to change notification settings - Fork 22.5k
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
feat: Editorial review: Add content covering modern approach to vertical form controls #32142
Conversation
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 putting it all together!
files/en-us/web/css/css_writing_modes/vertical_controls/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/css/css_writing_modes/vertical_controls/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/css/css_writing_modes/vertical_controls/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/css/css_writing_modes/vertical_controls/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/css/css_writing_modes/vertical_controls/index.md
Outdated
Show resolved
Hide resolved
Thanks a lot for the super helpful review, @dizhang168! I have answered all your comments. There is one outstanding question, and I'll make the change that's needed for that onceyou've provided an answer. |
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.
LGTM, all the behavior explanations I expect are there!
@dizhang168 Lovely, thank you for the super helpful tech review! I'll now turn this over to the other editors for an editorial review. |
Hey Chris, I can take a look at this. |
Yay, thanks @wbamberg! |
I had some questions about the first two examples, the ones about range, meters, and progress bars. Chrome(Canary, 124, started with FormControlsVerticalWritingModeDirectionSupport) In basic example I expect vertical sliders, drawn "top to bottom" (I assume this means that the blue part is at the top and the grey part is at the bottom). What I see is: In Drawing the control from bottom to top, I expect to see them going the other way, but I don't: Firefox(Nightly, 125) In basic example I expect vertical sliders, drawn "top to bottom". What I see is: ...that is, range has the expected direction, but the others don't. In Drawing the control from bottom to top, I see: ...that is, Note that removing Safari(16.6.1) In basic example I expect only the range to be displayed vertically, per the BCD, drawn "top to bottom". What I see is: But if I remove ...so it looks like |
@wbamberg so, for Safari, for writing-mode, I say "Support for range sliders, textual inputs, and textareas only". I think this is correct, but I also think I'm missing that this is available in Safari beta only, not full release version. @dizhang168 are you able to confirm that? For Firefox, I've got the effect of direction listed as false, which I'm pretty sure it was when I first wrote this. Another thing I need to update. For Chrome, I've documented it how I was told the state would be in Chrome 124, but it isn't there yet. @dizhang168, have you got any updates on when this behavior is going to be in the final Chrome release version? Thanks. |
I am working on the Intent to Ship for it (still planning for 124). To see the behavior for now, you need the latest 123 in Chrome Canary with experimental features enabled or by setting direction as on. For safari, I saw the feature was added in this release note: |
Co-authored-by: wbamberg <will@bootbonnet.ca>
OK, so I think we are pretty much done here. Thanks so much for a great editorial review, @wbamberg. Before I leave this, I'll review all the compat comments and make any changes needed to the BCD. And thanks for the technical review @dizhang168. I wanted to check in with you to see how the Chrome implementation is going. Looking at the examples in the new tutorial in the latest Canary, it looks like everything is working as it should, expect that the Is that your current understanding, and if so, is this still on track to be implemented in Chrome 124? I'm thinking that maybe I should delay publishing this new content until all the support is in place and published. |
Hi, that is correct. We are on track to ship it fully in stable in M124 (April 16, 2024 [1]). The Intent to Ship was approved last week. Would definitely appreciate if we can hold off until then, thanks! |
@dizhang168 Thanks for the info. I'm happy to hold off on publishing until the Chrome release. One question — I understand that it won't be in stable before then. But when that version hits beta, will this feature be enabled by default in beta? Or will it be behind a flag until it is in the release version? If the former, then I think we could publish it earlier than that. |
Hi there @dizhang168! Any updates on when this might be enabled in Chrome? I just checked on the latest (125) Nightly, and the behavior still doesn't seem as expected. |
Hi @chrisdavidmills! The feature is shipping soon, we are currently at 50% on stable and should reach 100% within the next two weeks. I think it is safe to publish these 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.
Please include labels on all form controls.
|
||
In older browsers that do not support the creation of vertical form controls with `writing-mode` and `direction`, there are limited alternatives available. The following only work on `<input type="range">`, causing the text to flow from bottom to top — they have no effect on `<meter>` and `<progress>` elements: | ||
|
||
- The non-standard `appearance: slider-vertical` property can be used in older versions of Safari and Chrome. |
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.
link appearance
property
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.
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.
Only include a link to the guide on pages where people are likely to rotate the form control. Limit to <input type=range>, <progress>
, and <meter>
.
The range page should include an example of a vertical bar. The progress and meter don't need to.
{{CSSRef}} | ||
|
||
The guide explains how to use the CSS {{cssxref("writing-mode")}} and {{cssxref("direction")}} properties to create and configure vertical form controls. This includes: | ||
|
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 would be great to put a basic example 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.
I'm not spending lots more time on this article. It was already reviewed and approved once. There are many examples further down the page.
|
||
## General technique | ||
|
||
In modern browsers, the {{cssxref("writing-mode")}} property can be set to a vertical value to cause relevant form controls to display vertically with normally horizontal text characters (for example in Latin languages) written on their side at a 90 degree angle from the default. Normally vertical text characters, for example in Chinese or Japanese, are unaffected in this regard. |
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.
In modern browsers, the {{cssxref("writing-mode")}} property can be set to a vertical value to cause relevant form controls to display vertically with normally horizontal text characters (for example in Latin languages) written on their side at a 90 degree angle from the default. Normally vertical text characters, for example in Chinese or Japanese, are unaffected in this regard. | |
In modern browsers, the {{cssxref("writing-mode")}} property can be set to a vertical value to vertically display form controls with text characters that are normally horizontal (for example in Latin languages), with text displayed at a 90-degree angle from the default. Normally vertical text characters, for example in Chinese or Japanese, are unaffected in this regard. |
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 want to include a note like this or something similar:
Note: While the {{cssxref("writing-mode")}} property is well supported, creating vertically-oriented form controls with the
writing-mode
only gained full browser support in 2024.
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
|
||
In modern browsers, the {{cssxref("writing-mode")}} property can be set to a vertical value to cause relevant form controls to display vertically with normally horizontal text characters (for example in Latin languages) written on their side at a 90 degree angle from the default. Normally vertical text characters, for example in Chinese or Japanese, are unaffected in this regard. | ||
|
||
This is useful when creating vertical language forms. Specifically: |
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.
Would be great to suggest an example here.
This is useful when creating vertical language forms. Specifically: | |
This is useful when creating vertical language forms, such as _______ . Specifically: |
Still not clear on a use case here. Why not just do a form.vertical {rotate: 90deg;}
?
The answer: the rotation would put it in it's own layer, with the new location possibly covering content while the original position box / location would appear empty / blank for the space taken up by the non-rotated control.
We likely should mention that somewhere in this guide.
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.
Note added about why not rotation. I don't think we need to add examples of vertical language forms.
- `writing-mode: vertical-lr` will create vertical form controls with a left-to-right block flow direction, meaning that in controls with wrapping or multiple lines of text, subsequent lines will appear to the right of previous lines. | ||
- `writing-mode: vertical-rl` will create vertical form controls with a right-to-left block flow direction, meaning that in controls with wrapping or multiple lines of text, subsequent lines will appear to the left of previous lines. | ||
|
||
> **Note:** The experimental `sideways-lr` and `sideways-rl` values have much the same effect as `vertical-lr` and `vertical-rl` respectively, except that normally vertical text characters (for example in Chinese or Japanese) are rotated 90 degress to display on their sides, and horizontal text characters (for example in Latin languages) are unaffected in this regard. |
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.
> **Note:** The experimental `sideways-lr` and `sideways-rl` values have much the same effect as `vertical-lr` and `vertical-rl` respectively, except that normally vertical text characters (for example in Chinese or Japanese) are rotated 90 degress to display on their sides, and horizontal text characters (for example in Latin languages) are unaffected in this regard. | |
> **Note:** The experimental `sideways-lr` and `sideways-rl` values have a similar effect as `vertical-lr` and `vertical-rl` respectively, except that normally vertical text characters (for example in Chinese or Japanese) are rotated 90 degrees to display on their sides, while horizontal text characters (for example in Latin languages) are unaffected by these values. |
is that what "in this regard" meant?
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.
Suggestion used
|
||
> **Note:** The experimental `sideways-lr` and `sideways-rl` values have much the same effect as `vertical-lr` and `vertical-rl` respectively, except that normally vertical text characters (for example in Chinese or Japanese) are rotated 90 degress to display on their sides, and horizontal text characters (for example in Latin languages) are unaffected in this regard. | ||
|
||
In addition, the {{cssxref("direction")}} property can be used to control the direction of the content inside the controls: |
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.
In addition, the {{cssxref("direction")}} property can be used to control the direction of the content inside the controls: | |
The {{cssxref("direction")}} property can be used to control the direction of content. This property can be used to control the direction of the content inside normally horizontal form controls that have been rotated 90 degrees with the `writing-mode` property: |
It property isn't limited to form controls. This makes that abundantly clear before going into the property's impacts on form controls.
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.
But this is contextual; this is what we are already talking about. We don't need to spell it out exhaustively.
@@ -347,6 +347,7 @@ draw(); | |||
|
|||
## See also | |||
|
|||
- [Creating vertical form controls](/en-US/docs/Web/CSS/CSS_writing_modes/Vertical_controls) |
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.
Very rarely do people have to create vertical form controls out of input elements other than possibly range. Please remove from all the input pages other than range, and remove from select and textarea, but keep on meter and progress. Also, do add to https://developer.mozilla.org/en-US/docs/Learn/Forms/Advanced_form_styling and https://developer.mozilla.org/en-US/docs/Learn/Forms/Styling_web_forms,
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 disagree; it is much more likely if you are creating Chinese or Japanese pages. I'm not spending ages updating all these See also sections again.
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.
@@ -1431,3 +1431,4 @@ Interactive elements such as form input should provide an area large enough that | |||
- [Styling HTML forms](/en-US/docs/Learn/Forms/Styling_web_forms) | |||
- [Advanced styling for HTML forms](/en-US/docs/Learn/Forms/Advanced_form_styling) | |||
- [CSS property compatibility table](/en-US/docs/Learn/Forms/Property_compatibility_table_for_form_controls) | |||
- [Creating vertical form controls](/en-US/docs/Web/CSS/CSS_writing_modes/Vertical_controls) |
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.
remove here. keep on line 698
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.
No; I think it is useful to expose here as well.
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.
let's keep this one, but remove it from all the sub-input pages (all the type pages).
@@ -71,14 +71,6 @@ The `step` attribute can also be set to the `any` string value. This `step` valu | |||
|
|||
The default stepping value for `range` inputs is 1, allowing only integers to be entered, _unless_ the stepping base is not an integer; for example, if you set `min` to -10 and `value` to 1.5, then a `step` of 1 will allow only values such as 1.5, 2.5, 3.5,… in the positive direction and -0.5, -1.5, -2.5,… in the negative direction. See the [HTML `step` attribute](/en-US/docs/Web/HTML/Attributes/step). | |||
|
|||
## Non-standard 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.
do not delete this section
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.
ok, added back.
``` | ||
|
||
{{EmbedLiveSample("Putting_it_all_together", 200, 200)}} | ||
To create a vertical range wherein the knob slides up and down, you can set the {{cssxref("writing-mode")}} property to a value of `vertical-rl` or `vertical-lr`, as explained in [Creating vertical form controls](/en-US/docs/Web/CSS/CSS_writing_modes/Vertical_controls). You can also set the CSS {{cssxref('appearance')}} property to the non-standard `slider-vertical` value if you want to support older versions of Chrome and Safari, and include the non-standard `orient="vertical"` attribute to support older versions of Firefox. |
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.
To create a vertical range wherein the knob slides up and down, you can set the {{cssxref("writing-mode")}} property to a value of `vertical-rl` or `vertical-lr`, as explained in [Creating vertical form controls](/en-US/docs/Web/CSS/CSS_writing_modes/Vertical_controls). You can also set the CSS {{cssxref('appearance')}} property to the non-standard `slider-vertical` value if you want to support older versions of Chrome and Safari, and include the non-standard `orient="vertical"` attribute to support older versions of Firefox. | |
To create a vertical range wherein the thumb slides up and down, set the {{cssxref("writing-mode")}} property with a value of either `vertical-rl` or `vertical-lr`. | |
To provide a fallback for non-supporting browsers, set the CSS {{cssxref('appearance')}} property to the non-standard `slider-vertical` value for older versions of Chrome and Safari, and include the non-standard `orient="vertical"` attribute to support older versions of Firefox. To learn more, see [Creating vertical form controls](/en-US/docs/Web/CSS/CSS_writing_modes/Vertical_controls). |
Then include examples to show top to bottom and bottom to top with vertical-rl
or vertical-lr
and the fallback example.
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've made this change and adjusted things around a bit. I'm not adding in another example as we link to the "Creating vertical form controls" page for examples.
- {{ HTMLElement("output") }} | ||
- {{ HTMLElement("progress") }} | ||
- {{ HTMLElement("meter") }} | ||
- [Creating vertical form controls](/en-US/docs/Web/CSS/CSS_writing_modes/Vertical_controls) |
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.
revert
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.
No, as explained in an earlier comment.
…t into vertical-controls
- `writing-mode: vertical-lr` will create vertical form controls with a left-to-right block flow direction, meaning that in controls with wrapping or multiple lines of text, subsequent lines will appear to the right of previous lines. | ||
- `writing-mode: vertical-rl` will create vertical form controls with a right-to-left block flow direction, meaning that in controls with wrapping or multiple lines of text, subsequent lines will appear to the left of previous lines. | ||
|
||
You could use a [transform](/en-US/docs/Web/CSS/transform) to rotate the controls by 90 degrees, but that would place the controls in their own layer and cause unintended layout side effects such as other content being overlapped. Using `writing-mode` offers a more reliable solution. |
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.
perfect
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.
just added a quick example to range. After that we should be good to go.
Co-authored-by: Estelle Weyl <estelle@openwebdocs.org>
Description
Chrome has added support for vertical form controls; see https://developer.chrome.com/blog/vertical-form-controls for some more details. Specifically:
This is done by setting
writing-mode
tovertical-lr
orvertical-rl
. In some cases, thedirection
property can also be used to configure the form rendering in more complex ways than just obvious text alignment (e.g. rendering range sliders top to bottom or bottom to top).This PR adds a separate article to explain how this is all done in one place and updates several other articles to link from it in appropriate places.
Motivation
Additional details
Related issues and pull requests
See mdn/browser-compat-data#22179 for the related compat data, which has turned out to be quite complicated.