Skip to content
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

Merged
merged 20 commits into from
Apr 5, 2024

Conversation

chrisdavidmills
Copy link
Contributor

@chrisdavidmills chrisdavidmills commented Feb 6, 2024

Description

Chrome has added support for vertical form controls; see https://developer.chrome.com/blog/vertical-form-controls for some more details. Specifically:

  • Vertical Selects/buttons released in 119
  • Vertical textareas/text-based inputs in 121
  • Vertical progress/meter/input type range in 124

Currently the latter is available in a Finch experiment, enabled 50% on Canary only. To make sure it is available on mac on Mac, you can start Canary by passing the feature:
/Applications/"Google Chrome Canary.app"/Contents/MacOS/"Google Chrome Canary" --enable-features=FormControlsVerticalWritingModeDirectionSupport

This is done by setting writing-mode to vertical-lr or vertical-rl. In some cases, the direction 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.

@chrisdavidmills chrisdavidmills requested review from a team as code owners February 6, 2024 16:18
@chrisdavidmills chrisdavidmills requested review from dipikabh and removed request for a team February 6, 2024 16:18
@github-actions github-actions bot added Content:CSS Cascading Style Sheets docs Content:HTML Hypertext Markup Language docs labels Feb 6, 2024
@chrisdavidmills chrisdavidmills changed the title Add content covering modern approach to vertical form controls Technical review: Add content covering modern approach to vertical form controls Feb 6, 2024
@github-actions github-actions bot added the size/m [PR only] 51-500 LoC changed label Feb 6, 2024
Copy link
Contributor

github-actions bot commented Feb 6, 2024

Preview URLs (11 pages)
Flaws (2)

Note! 9 documents with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Web/CSS/CSS_writing_modes
Title: CSS writing modes
Flaw count: 1

  • macros:
    • /en-US/docs/Web/CSS/glyph-orientation-horizontal does not exist

URL: /en-US/docs/Web/HTML/Element/input/range
Title: <input type="range">
Flaw count: 1

  • macros:
    • /en-US/docs/Web/API/HTMLInputElement/valueAsNumber does not exist
External URLs (3)

URL: /en-US/docs/Web/HTML/Element/input/tel
Title: <input type="tel">


URL: /en-US/docs/Web/HTML/Element/input/email
Title: <input type="email">

(comment last updated: 2024-04-05 09:03:53)

Copy link

@dizhang168 dizhang168 left a 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!

@chrisdavidmills
Copy link
Contributor Author

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.

Copy link

@dizhang168 dizhang168 left a 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!

@chrisdavidmills
Copy link
Contributor Author

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.

@chrisdavidmills chrisdavidmills changed the title Technical review: Add content covering modern approach to vertical form controls feat: Editorial review: Add content covering modern approach to vertical form controls Feb 14, 2024
@github-actions github-actions bot added size/l [PR only] 501-1000 LoC changed and removed size/m [PR only] 51-500 LoC changed labels Feb 19, 2024
@wbamberg
Copy link
Collaborator

Hey Chris, I can take a look at this.

@chrisdavidmills
Copy link
Contributor Author

Hey Chris, I can take a look at this.

Yay, thanks @wbamberg!

@wbamberg
Copy link
Collaborator

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:

Screen Shot 2024-02-23 at 10 36 54 AM

In Drawing the control from bottom to top, I expect to see them going the other way, but I don't:

Screen Shot 2024-02-23 at 10 37 59 AM

Firefox

(Nightly, 125)

In basic example I expect vertical sliders, drawn "top to bottom".

What I see is:

Screen Shot 2024-02-23 at 10 41 34 AM

...that is, range has the expected direction, but the others don't.

In Drawing the control from bottom to top, I see:

Screen Shot 2024-02-23 at 10 42 59 AM

...that is, direction does have an effect, but only for range.

Note that removing appearance: slider-vertical; doesn't seem to affect things either way.

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:

Screen Shot 2024-02-23 at 10 50 07 AM

But if I remove appearance: slider-vertical;, then I see:

Screen Shot 2024-02-23 at 10 51 10 AM

...so it looks like writing-mode isn't having any effect in Safari.

@chrisdavidmills
Copy link
Contributor Author

@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.

@dizhang168
Copy link

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:
https://developer.apple.com/documentation/safari-release-notes/safari-17_4-release-notes

@chrisdavidmills
Copy link
Contributor Author

chrisdavidmills commented Mar 6, 2024

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 direction property doesn't seem to have any effect on range/meter/progress. When I look at the examples under https://pr32142.content.dev.mdn.mozit.cloud/en-US/docs/Web/CSS/CSS_writing_modes/Vertical_controls#range_sliders_meters_and_progress_bars, the default seems to be bottom to top rendering (it should be top to bottom, right?), and direction seems to have no effect.

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.

@dizhang168
Copy link

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!

[1] https://chromiumdash.appspot.com/schedule

@chrisdavidmills
Copy link
Contributor Author

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!

[1] https://chromiumdash.appspot.com/schedule

@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.

@dipikabh dipikabh removed their request for review March 19, 2024 21:30
@chrisdavidmills
Copy link
Contributor Author

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.

@dizhang168
Copy link

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.

Copy link
Member

@estelle estelle left a 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

link appearance property

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

@estelle estelle left a 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:

Copy link
Member

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.

Copy link
Contributor Author

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Member

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.

Copy link
Contributor Author

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:
Copy link
Member

@estelle estelle Apr 3, 2024

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.

Suggested change
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.

Copy link
Contributor Author

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> **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?

Copy link
Contributor Author

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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Contributor Author

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)
Copy link
Member

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,

Copy link
Contributor Author

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.

Copy link
Member

@estelle estelle Apr 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just pick a few places to include the guide. How about meter, progress, range and, optionally, the input main page

Note that it is already in the range and input pages, in the content of the page, as well

@@ -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)
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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
Copy link
Member

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

Copy link
Contributor Author

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Contributor Author

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert

Copy link
Contributor Author

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.

- `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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect

Copy link
Member

@estelle estelle left a 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.

files/en-us/web/html/element/input/range/index.md Outdated Show resolved Hide resolved
Co-authored-by: Estelle Weyl <estelle@openwebdocs.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:CSS Cascading Style Sheets docs Content:HTML Hypertext Markup Language docs size/l [PR only] 501-1000 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants