Fix typo in input placeholder color class#1940
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1940 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 70 70
Lines 1316 1316
Branches 486 486
=========================================
Hits 1316 1316 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Are there any cases where we do want to inherit the color that you can think of? For example input fields that set the text to red if there is an error or something. Do we have a mechanism to do that if needed? |
Our existing I can't think on any case where we currently need to change the text color, but I think it would be reasonable to just set the placeholder text and continue inheriting the main text color. I would in that case do the same in hypothesis/client#6966, for consistency. |
|
I just checked that, in LMS, client and via, all usages of So we could just keep grey-9 for all, via inheriting the page color. |
This makes sense as an incremental step. In future we should consider whether we want to harmonize the text color between the client, LMS and other apps. |
cc23321 to
9f84354
Compare
| 'focus-visible-ring ring-inset border rounded w-full p-2', | ||
| 'bg-grey-0 focus:bg-white disabled:bg-grey-1', | ||
| 'placeholder:text-color-grey-5 disabled:placeholder:color-grey-6', | ||
| 'placeholder:text-grey-6 disabled:placeholder:text-grey-7', |
There was a problem hiding this comment.
Neither text-color-grey-5 or color-grey-6 were valid tailwind classes, but even if they were, grey-5 is too light in contrast with white.
There was a problem hiding this comment.
We really ought to have a lint to check validity of classes. I suspect there was confusion here because we do have some custom text-color-* properties.
There was a problem hiding this comment.
I suspect there was confusion here because we do have some custom text-color-* properties.
Yep, that was also my thinking.
@robertknight can you take another look? I have reverted the |
There was a problem hiding this comment.
This change seems like the most straightforward way of addressing the accessibility hazard with placeholder text. It does however mean that contrast is a weaker cue than before that text in an input field is a placeholder. This raises the importance of adding other cues such as adding an ellipsis at the end.
GitHub recently made a similar change across their input fields and it runs into the same challenges.
(Edit: We're having second thoughts on the ellipsis suggestion here: https://hypothes-is.slack.com/archives/C1M8NH76X/p1744210176861699?thread_ts=1744191013.167509&cid=C1M8NH76X)
| 'focus-visible-ring ring-inset border rounded w-full p-2', | ||
| 'bg-grey-0 focus:bg-white disabled:bg-grey-1', | ||
| 'placeholder:text-color-grey-5 disabled:placeholder:color-grey-6', | ||
| 'placeholder:text-grey-6 disabled:placeholder:text-grey-7', |
There was a problem hiding this comment.
We really ought to have a lint to check validity of classes. I suspect there was confusion here because we do have some custom text-color-* properties.

Part of hypothesis/client#6866
This PR does two things:
Inputtailwind classes around placeholder text color.InputandTextareatext color andplaceholder color, following the changes in Improve contrast ratio in annotation textarea client#6966Inputs were previously inheriting the text color from the page, having inconsistent values. Now we settle togrey-8The previous placeholder color (even though it was not working due to the typo mentioned above) was too light in contrast with white background. Now we settle to
grey-6, which has more than 4.5 contrast, as required by accessibility guidelines.