web-components icon indicating copy to clipboard operation
web-components copied to clipboard

`<vaadin-input-container>`: `vaadin-input-field-value-font-weight` is kaput

Open anezthes opened this issue 1 year ago • 2 comments

Description

vaadin-input-field-value-font-weight doesn't work; changing its value has no effect on the input element's font weight.

Expected outcome

Changing the value of vaadin-input-field-value-font-weight should alter the font weight of the input element. However, no visible change occurs, and the font weight remains unaffected.

Minimal reproducible example

html {
  vaadin-input-field-value-font-weight: 700;
}

Steps to reproduce

  1. Go to https://vaadin.com/docs/latest/components/text-field
  2. Open up the inspection tools
  3. Paste vaadin-input-field-value-font-weight: 700; into the element style of vaadin-text-field

Environment

Vaadin version(s): 24.5 OS: macOS Sequoia

Browsers

All of them

anezthes avatar Oct 09 '24 09:10 anezthes

The style is overridden here and this style on vaadin-input-container takes precedence over the one defined on the host element (in this case vaadin-text-field). IMO we should move the custom property to be used here instead:

https://github.com/vaadin/web-components/blob/5c8f87221349229963ca7f6837e56b04022171f0/packages/input-container/theme/lumo/vaadin-input-container-styles.js#L13

web-padawan avatar Oct 09 '24 10:10 web-padawan

I noticed the same today.

One can add styles like this in project to patch it

vaadin-text-area > textarea {
   font-weight: var(--vaadin-input-field-value-font-weight);
}

vaadin-text-field > input {
   font-weight: --vaadin-input-field-value-font-weight;
}

TatuLund avatar Oct 11 '24 07:10 TatuLund