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

Handle custom input size with CSS to fix different behaviour across browsers #101

Closed
adamkudrna opened this issue Jun 8, 2020 · 0 comments · Fixed by #108
Closed

Handle custom input size with CSS to fix different behaviour across browsers #101

adamkudrna opened this issue Jun 8, 2020 · 0 comments · Fixed by #108
Assignees
Labels
Milestone

Comments

@adamkudrna
Copy link
Member

Problem

It seems that implementation of input size attribute differs across browsers: inputs are narrower in Chrome than in Firefox and Safari:

image

↑ Input with size of 16, Chrome.

image

↑ The same field in Firefox.

This is probably caused by vague specification of HTML.

Suggested Solution

There is probably no pure HTML + CSS solution, CSS cannot apply the value of size attribute anywhere else than in content.

However, we can take the value of inputSize and pass it to CSS through a custom property. Setting a width should then be as easy as this:

width: calc(1ch * var(--rui-local-input-size));

Or probably more purely:

width: var(--rui-local-input-size);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant