Skip to content

[selectmenu] How should writing-mode work with selectmenu #600

Open

Description

@gregwhitworth

The amazing Scott Kellum dropped by our discord to inquire about the following:

I’m running into an issue with writing-mode and UI elements. It works as expected in Firefox but the UI elements in Chrome/Safari don’t respect the writing-mode applied to them.
https://codepen.io/scottkellum/pen/poLmmRB/4bbd0fd358fec6f42d8cf279679f7183
Is this issue documented anywhere or is it being worked on?

While I do think there should be some general discussion around how writing-modes function with respect to replaced elements I think it's worth looking at the <selectmenu> in its current form and determine if this is the expected behavior. Here is a forked version of Scott's pen including the new <selectmenu>.

Just in case you don't have experimental flags enabled on a Chromium browser; here is how it renders:

Screen Shot 2022-08-29 at 8 37 31 PM

Note that the CSS is very basic in that it simply applies the writing mode to all of HTML

selectmenu {
	writing-mode: vertical-lr;
}

So basically what is happening is that the replaced element is not adhering to this writing mode. If I replace the default content with my own:

<div slot="button">
    <div behavior="button" class="fake-input">
      Open
      <span class="arrow">&#9660;</span>
    </div>
    <div>
      <p>Selected Value: 
        <span behavior="selected-value" slot="selected-value"></span>
      </p>
    </div>
  </div>

We end up with the following rendering:

Screen Shot 2022-08-29 at 8 52 10 PM

Here is what the spec says with regards to replaced elements respecting writing modes:

The content of replaced elements do not rotate due to the writing mode: images and external content such as from <iframe>s, for example, remain upright, and the default object size of 300px×150px does not re-orient. However embedded replaced content involving text (such as MathML content or form elements) should match the replaced element’s writing mode and line orientation if the UA supports such a vertical writing mode for the replaced content.

Based on what the spec says I think this comes down to whether we want the selectmenu shadow DOM to use other replaced elements or not, in this case an input? And I'm primarily curious what users that consume content in this writing mode; what do they prefer? No matter what we decide on the prior topic of using replaced elements; we'll want to have the default styles be something that users will want.

Activity

  1. added
    select
    i18n-tracker
    CSSWG
    on Aug 30, 2022
  2. gregwhitworth commented on Aug 30, 2022

    @gregwhitworth
    MemberAuthor
  3. added
    agenda+
    on Aug 30, 2022
  4. fantasai commented on Aug 30, 2022

    @fantasai

    The Writing Modes spec actually has an example of both an input and a select drop-down in vertical writing mode to illustrate the expectations: https://www.w3.org/TR/css-writing-modes-4/#example-fb72ee40

    The requirement to do it right is only a SHOULD rather than a MUST because there's a wide variety of replaced elements, and a UA might not be able to handle all of them appropriately.

    But for form controls, they are under the UA's control, so it should be trying. My expectation would be that every bit of text that's horizontal in a horizontal writing mode should be vertical in a vertical writing mode, and the layouts should be adjusted analogously. Remember that some writing systems are vertical-only, the same way that English is horizontal-only, and while sometimes “sideways” text (wrt native orientation) is appropriate in a design, that's not going to be normal or particularly readable.

  5. scottkellum commented on Aug 30, 2022

    @scottkellum

    Thanks @fantasai that’s some really helpful/interesting context.

    The requirement to do it right is only a SHOULD rather than a MUST

    I can understand this. Is there any way we might be able to increase the pressure here? Writing modes have significant impact on layout and I can’t think of an easy way to test for this with @supports.

  6. gregwhitworth commented on Aug 30, 2022

    @gregwhitworth
    MemberAuthor

    The Writing Modes spec actually has an example of both an input and a select drop-down in vertical writing mode to illustrate the expectations: https://www.w3.org/TR/css-writing-modes-4/#example-fb72ee40

    LOL, that's what I get for simply searching for replaced elements rather than reading the whole spec :P

    Thanks as always @fantasai

  7. added a commit that references this issue on Sep 1, 2022
  8. added
    agenda+
    and removed
    agenda+
    on Sep 21, 2022
  9. css-meeting-bot commented on Sep 29, 2022

    @css-meeting-bot

    The Open UI Community Group just discussed How should writing-mode work with selectmenu, and agreed to the following:

    • RESOLVED: UAs must respect writing-mode for all of a selectmenu's default content.
    The full IRC log of that discussion <gregwhitworth> Topic: How should writing-mode work with selectmenu
    <gregwhitworth> github: https://github.com//issues/600
    <hdv> gregwhitworth: there are interop issues between how browsers handle the current select menu… so I wanted to see if we can address this in selectmenu and figure out how we should handle writing modes
    <hdv> gregwhitworth: I pinged @@@ from the CSSWG and there are some examples in the spec that are using select as an example of how it should work
    <dbaron> s/@@@/fantasai and Florian/
    <hdv> gregwhitworth: the spec says should rather thanmust, but I think we could probably say must
    <hdv> gregwhitworth: I don't think when someone does the writing mode they wouldn't expect the selectmenu itself to be turned but not the options inside
    <dandclark> q+
    <hdv> gregwhitworth: I'm curious what people's thoughts are
    <masonf> q+
    <gregwhitworth> ack dbaron
    <hdv> dbaron: when thinking about writing modes, there are a few languages to think about… a lot of examples are for Chinese or Japanese, which are languages that can be written horizontally or vertically… it can in many ways be a stylistic choice
    <hdv> dbaron: there are however also languages where it is mandatory to use a specific writing mode
    <gregwhitworth> ack dandclark
    <hdv> dbaron: when we design things we have to make sure it can do vertical text, otherwise languages like Mongolian would not work
    <hdv> dandclark: this came up because the selectmenu uses the native select for its button… so we end up with a popup that does respect vertical writing mode but a button that doesn't
    <hdv> dandclark: so I think we at least should have a MUST that the selectmenu should follow the writing mode… if the button does not reflect it, like in current Chromium, then the popup should ignore it too , so that it is not werid
    <bkardell_> dbaron: yeah, first appearance of "marker" in a spec is march 98 I think https://www.w3.org/TR/1998/PR-CSS2-19980324/generate.html#markers
    <bkardell_> but the pseudo-element itself, is the one I mentioned above with the funny note
    <hdv> dandclark: I'd like to see these buttons respect writing mode… not sure how realistic it is if we just say for a selectmenu you must
    <gregwhitworth> ack masonf
    <hdv> dandclark: there seems to be a contradiction to say it should work for selectmenu, but we don't fix it for button at the same time
    <gregwhitworth> q+
    <scottkellum> q+
    <hdv> masonf: I think I agree with what dandclark said… not sure if there is already a bug for the button issue?
    <sarah_h> this is a pretty good reference, and also recommends having the button follow writing mode: https://www.w3.org/International/articles/vertical-text/#forms_etc
    <hdv> gregwhitworth: my only qualm with SHOULDs is that we finally get an opportunity to write MUST, all form element things have had SHOULD until now
    <bkardell_> dbaron: sorry I got confused about where you replied :)
    <hdv> gregwhitworth: and then browser makers can decide on if they'll implement it… but at least we decide what the right behavior is
    <gregwhitworth> ack gregwhitworth
    <hdv> scottkellum: to clarify… it's not just selectmenu, button and all of the various inputs, input type range and others. So this is also an interop thing, I'm not quite sure… it's very difficult from a design perspective, because writing mode is so important when it comes to design, it becomes very complicated to design UIs that some browsers support going in one direction, some in another, with various writing modes
    <gregwhitworth> ack scottkellum
    <gregwhitworth> ack dbaron
    <hdv> gregwhitworth: I'm not opposed to having the discussion… just saying we're working on selectmenu now. It makes sense to add to Interop 2023
    <masonf> +1 to adding writing modes for form controls to Interop2023...
    <hdv> dbaron: one other place where it might make sense to write a requirement… maybe this is what you meant but not sure if you said it explicitly… if the button in the selectmenu visually shows you a direction or orientation, that that button should reflect the actual orientation you're going to get
    <hdv> gregwhitworth: technically you don't know when you lay that glyph out, you don't know where it is going to be
    <hdv> dbaron: in many cases it will go either up or down, not sideways
    <hdv> gregwhitworth: would we know at style cascade time?
    <hdv> masonf: when you put the button you don't know where it will go
    <hdv> gregwhitworth: when you've done the cascade and it is sitting on computed style, you know, like I'll try to be anchored on the centre right
    <hdv> dbaron: what I tried to say is… you shouldn't depend on lots of interesting anchoring styles… if the _language_ is such that you would expect a certain direction, that is followed
    <dandclark> Not an expert on writing modes, but does this work? Proposed resoution: UAs must respect writing-mode for all of a selectmenu's default content.
    <hdv> dbaron: seems reasonable to me
    <dandclark> RESOLVED: UAs must respect writing-mode for all of a selectmenu's default content.
    <dbaron> (might make sense to eventually have more concrete requirements in the spec, though)
  10. added
    needs edits
    and removed
    agenda+
    on Oct 4, 2022
  11. r12a commented on Jan 25, 2023

    @r12a
    Collaborator

    I only just now noticed this thread. Fwiw, the i18n WG has an open gap report on this topic at w3c/clreq#247. That points to some tests that may be useful, and to bug reports we raised against browsers.

    One thing that is not made clear there, nor here, nor did i mention it at https://www.w3.org/International/articles/vertical-text/#forms_etc, is the cascade direction for a select list. In vertical Chinese & Japanese (& Korean) you'd expect the items to select should extend to the left of the line, since that's the direction in which lines flow for those languages (ie. vertical-rl).

    For Mongolian, however, vertical lines flow from left to right, so the select options, should probably appear on the right. And any little angled pointer should also point to the right.

  12. 14 remaining items

  13. added a commit that references this issue on Apr 13, 2023
  14. github-actions commented on Sep 22, 2023

    @github-actions
    Contributor

    There hasn't been any discussion on this issue for a while, so we're marking it as stale. If you choose to kick off the discussion again, we'll remove the 'stale' label.

  15. josepharhar commented on Mar 21, 2024

    @josepharhar
    Collaborator

    Now that we are going to reuse the select element instead of creating a new selectmenu/selectlist element in response to apple feedback, my plan is still the same: support writing-mode etc. for the new thing. I'm not sure if there needs to be any special considerations in the CSS or WHATWG specs.

  16. added
    agenda+
    on Apr 24, 2024
  17. css-meeting-bot commented on Apr 25, 2024

    @css-meeting-bot

    The Open UI Community Group just discussed [selectmenu] How should writing-mode work with selectmenu, and agreed to the following:

    • RESOLVED: <select> MUST support writing-modes but it will be defined in another issue that covers the user-agent stylesheet default styles when appearance: base-select is set
    The full IRC log of that discussion <una> q+
    <masonf> q+
    <brecht_dr> jarhar I think we should make the new select support other writing modes, maybe it's just that
    <gregwhitworth> ack una
    <gregwhitworth> q+
    <brecht_dr> una question: regarding button and writing mode. It looks that the button is not respecting the writing mode, but the selected option do. There seems to be a few funky things going on there
    <dbaron> I just wrote a review comment on Joey's most recent patch that he sent me for review... where he didn't get writing mode handling correct in the default styles :-) But it is easily fixable.
    <brecht_dr> una +1 on the writing mode though. Is this also going to be specced in the design is another question I have
    <brecht_dr> jarhar We want to let this up to the browsers for a part, it's not clarified in detail
    <gregwhitworth> https://github.com//issues/600#issuecomment-1231181295
    <gregwhitworth> fantasai comment ^
    <brecht_dr> masonf Ofcourse we should suppor the writing modes, the tricky bit is how it should behave in different writing modes
    <brecht_dr> masonf In terms on this issue we should just resolve on supporting it. We could take it further about the actual design for this later on
    <brecht_dr> gregwhitworth Are we going to define and spec this? I think we should. It's relatively clearly defined in an internationalization
    <dandclark> q+
    <gregwhitworth> ack gregwhitworth
    <brecht_dr> gregwhitworth I think we should resolve that it MUST (not should) and this should be defined in the UA stylesheet to be determined
    <dandclark> https://github.com/w3c/csswg-drafts/issues/8633
    <gregwhitworth> ack dbaron
    <Luke> q+
    <brecht_dr> dbaron I think a lot of the interesting stuff is going to be when we specify the default styles for this
    <brecht_dr> dbaron there will be details, but i'm sure we'll get it right
    <gregwhitworth> ack dandclark
    <gregwhitworth> ack Luke
    <brecht_dr> Luke Is there a way to style based on the writing mode?
    <gregwhitworth> q+
    <brecht_dr> dbaron A lot of it will be based on using logical properties in the base styles
    <gregwhitworth> ack gregwhitworth
    <dbaron> https://drafts.csswg.org/css-logical-1/
    <una> that also solves the spec piece, if its specced with logical properties
    <dbaron> s/in the base styles/in the styles authors write/
    <gregwhitworth> Proposed Resolution: <select> MUST support writing-modes but it will be defined in another issue that covers the user-agent stylesheet default styles when appearance: select-base is set
    <masonf> base-select
    <masonf> +1
    <gregwhitworth> Proposed Resolution: <select> MUST support writing-modes but it will be defined in another issue that covers the user-agent stylesheet default styles when appearance: base-select is set
    <Luke> +1
    <brecht_dr> +1
    <keithamus> +1
    <dandclark> +1
    <gregwhitworth> RESOLVED: <select> MUST support writing-modes but it will be defined in another issue that covers the user-agent stylesheet default styles when appearance: base-select is set
    <dbaron> +1
  18. removed
    agenda+
    on Apr 30, 2024
  19. github-actions commented on Oct 28, 2024

    @github-actions
    Contributor

    There hasn't been any discussion on this issue for a while, so we're marking it as stale. If you choose to kick off the discussion again, we'll remove the 'stale' label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CSSWGi18n-trackerneeds editsneeds-triageselect

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions