-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Rendering <input type=range> vertically #4177
Comments
Note the disadvantage of using a CSS property that I brought up in an email to www-style back in 2013. |
(And discussion in the Mozilla bug to decide how to handle orientation.) |
You mean the disadvantage that authors can't use " |
I agree that ratio of width/height is a bad idea, and -webkti-appearance:slider-vertical is also a bad idea. I'd be happy if UA can detect orientation with DOM level information such as content attribute because the current range implementation in Blink uses shadow nodes and updating shadow nodes style depending on the host style needs a hack. |
Is that just an implementation issue in Blink or is it a more fundamental design error in Shadow DOM? It seems kind of sad to me if Shadow DOM implies that we're going back to styling things using HTML attributes instead of CSS. |
That sounds like a Blink limitation, unless a vertical range control requires a different shadow tree structure. |
It's an implementation issue of WebKit and Blink. |
I'm not sure we should be designing more magic, un-implementable-using-web-developer-exposed-technologies, abilities into the built-in form controls. |
Yeah, lack of CSS-listeners is what's really hurting this. You can listen for attribute changes and respond accordingly; all you can do for CSS is poll. |
Another wild idea is just dropping the vertical rendering from the specification. |
I wrote:
I had some local experiments. If the orientation just follow the |
Vertical |
We can set the default direction of the progress bar for different For example, I'm a Chinese user, and in Imagine there's a thermometer on the page 🌡 I would prefer bottom to top. |
@yisibl can't you override individual controls using |
@annevk Considering that input ranges often have a tooltip, I don't want the text direction of the tooltip to change when adding: input[type="range"] {
writing-mode: vertical-lr;
}
::-webkit-slider-thumb {
anchor-name: --thumb;
}
input[type="range"]::after {
content: attr(data-value);
position: fixed;
anchor-default: --thumb;
left: anchor(center);
top: auto;
bottom: calc(anchor(auto) + 5px);
translate: -50% 0;
} So I think the direction of the progress bar should not be coupled with the writing-mode. |
I quote and agree with @andreubotella #8413 (comment) |
The HTML specification is confusing in its description of vertical rendering, and in any case, I think the specification should be updated as soon as possible, as said here again:
|
There is a wide demand for a vertical input range community:
Vertical input ranges are also very common in cell phone operating systems. For example, iOS: The confusion of the specification brings poor interoperability and we need to reach a consensus as soon as possible. I prefer having a CSS property to control direction. |
The Rendering section suggests that:
This is bad for a few reasons:
width/height
of the control. This is bad since the intrinsic size of this element varies between platforms and is affected by the user's native theme, so it cannot be known in advance by the style sheet author. Specifying definite sizes are bad in general since they don't work well if the user has set a non-default preferred font-size in their Preferences.<option label>
text. This use case can't be supported if the control magically switches to horizontal layout when that happens.There needs to be a way for authors to request a vertical/horizontal control and still have it intrinsically sized. Authors currently do that in incompatible ways for each UA. This note summarizes the problems with current solutions:
https://css-tricks.com/sliding-nightmare-understanding-range-input/#orientation
Using CSS
transform
orwriting-mode
for this is bad since a vertical control may not have the same appearance as a rotated horizontal control. It also rotates the label text which is undesirable. The Blink/WebKit solution to have different-webkit-appearance
value (slider-vertical
) is also bad since it prevents the author from applying custom styling to a vertical control (you generally want-webkit-appearance:none
for that). The Gecko solution of using aorient
attribute is not good since this is something that should be controlled by CSS.I think we need to standardize something that works in all UAs without those problems.
I propose that
<input type=range>
should have-webkit-appearance:range
in the UA sheet for both horizontal and vertical controls and that we introduce a new CSS property to control the orientation,e.g.
orientation: horizontal | vertical | inline-axis | block-axis
.CC @zcorpan @tkent-google @jwatt
The text was updated successfully, but these errors were encountered: