Page MenuHomePhabricator

[BUG] WiKit Input placeholder should display the correct color
Closed, ResolvedPublic3 Estimated Story PointsBUG REPORT

Description

List of steps to reproduce
Open the Input component demo page or the Lookup demo in any browser

What happens?:
The placeholder of these components displays the placeholder color (Chrome, Safari) or opacity (Firefox) assigned by the browser by default, which unfortunately happens to not have enough contrast in some cases.

ChromeSafariFirefox
Screenshot 2022-07-07 at 21.37.50.png (1×3 px, 826 KB)
Screenshot 2022-07-07 at 21.47.50.png (1×2 px, 593 KB)
Screenshot 2022-07-08 at 16.07.40.png (1×3 px, 676 KB)

What should have happened instead?:
The placeholder of WiKit Inputs (and the derived Lookup) should display the color specified in the Input component tokens: #72777d (or $font-color-subtle).

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:

Tested in Safari v15.5, Firefox Nightly 104 and Chrome v103 on MacOS Monterey.

This issue affects all the projects and features that are reusing WiKit Inputs and. Lookups: The Special:NewLexemeAlpha page and Query builder. Their corresponding tags were added for visibility.

(Please note that TextArea is not affected, as it displays the right, specified placeholder color).

A/C:

  • Placeholder color is correctly displayed in Wikit Input, Lookup and TextArea components
  • Make a Wikit pre-release for Vue3
  • Make a Wikit pre-release for Vue2
  • Update Wikit version in Special New Lexeme after doing Wikit Vue3 pre-release
  • Update Wikit version in Query Builder after doing Wikit Vue2 pre-release
  • Update Wikit version in Mismatch Finder after doing Wikit Vue2 pre-release

Event Timeline

Restricted Application changed the subtype of this task from "Task" to "Bug Report". · View Herald TranscriptJul 8 2022, 10:36 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Special thanks to @Quiddity for the great catch and for filing an initial report: T312291

karapayneWMDE set the point value for this task to 3.Jul 26 2022, 9:20 AM

Relevant PRs:
Updating the tokens in Input component: https://github.com/wmde/wikit/pull/624
Updating the tokens in TextArea component: https://github.com/wmde/wikit/pull/627
Wikit pre-release for Vue3: https://github.com/wmde/wikit/pull/625
Update Wikit in special-new-lexeme: https://github.com/wmde/new-lexeme-special-page/pull/262
Wikit pre-release for Vue2: https://github.com/wmde/wikit/pull/628
Update wikit version in Wikidata Mismatch Finder: https://github.com/wmde/wikidata-mismatch-finder/pull/395
Update wikit in Query Builder: https://gerrit.wikimedia.org/r/c/wikidata/query-builder/+/822343

Hello @Sarai-WMDE, I have added the placeholder color property to the input component, could you check that it looks fine? This is the deployed address: https://2385b85125ce066b1c16e699afb51fc3822b1764--wmde-wikit.netlify.app. It looks fine now in Chrome but I am not sure about the contrast in Firefox, even though the inspector is showing the right color, it doesn't look like the contrast is very strong in my local version of Chrome.

Thanks for the change, @guergana.tzatchkova! Looks like the inputs' placeholders now display the right color in Chrome and Safari. The problem with Firefox is that the browser applies an opacity of 0.54 by default, that's what causing the lower contrast:

Screenshot 2022-08-05 at 12.04.57.png (1×2 px, 554 KB)

I think we should specify that the placeholder has full opacity at the component level, something like:

&::placeholder {
		color: $wikit-Input-placeholder-color;
                opacity: $wikit-Input-placeholder-opacity; [NEW]
	}

This involves creating a couple of tokens:

The new component token $wikit-Input-placeholder-opacity will consume a new alias token called $opacity-base, that will need to be added to the alias.json file. The latter alias token should consume the global token $opacity-100.

@Sarai-WMDE upon checking this behavior in Mismatch Finder, I noticed that the color in the TextArea is right but the opacity is still not 1.

Oh! Makes sense because these are different components. I totally forgot to check. We should create and apply an opacity component token for TextArea, same we did for Input. Should we apply changes in the same patch?

TextInput, Lookup and TextArea have been fixed in WiKit, and they now display the right placeholder color (#72777d). The elements in the Special:NewLexeme page in Beta are displaying the right styles, and so is the TextArea in Mismatch finder.

I believe, though, that the version of Wikit hasn't been updated in Query Builder (see last AC): the input elements included there are not aligned with the latest changes.

Thanks for verifying this @Sarai-WMDE , I will move this back to todo so that the query builder can be updated

TextInput, Lookup and TextArea have been fixed in WiKit, and they now display the right placeholder color (#72777d). The elements in the Special:NewLexeme page in Beta are displaying the right styles, and so is the TextArea in Mismatch finder.

I believe, though, that the version of Wikit hasn't been updated in Query Builder (see last AC): the input elements included there are not aligned with the latest changes.

I forgot to update the ticket but the changes have been applied. The last build (#13) of query-builder to production was made on June 22. I am creating a new query builder build for production (#14), then you will be able to see the changes in https://query.wikidata.org/querybuilder/?uselang=en

All up to date! Input-type components now display the right placeholder color (and opacity) in the last Query builder build (pun always intended). Thanks @guergana.tzatchkova!

(Verified in Chrome v104, Safari v15.6 and Firefox Nightly v106 on macOS Monterey)