Skip to content

Add WHCM support for all the form elements#2830

Merged
dannify merged 50 commits into
adobe:mainfrom
jnurthen:WHCM-inputs
Jul 19, 2022
Merged

Add WHCM support for all the form elements#2830
dannify merged 50 commits into
adobe:mainfrom
jnurthen:WHCM-inputs

Conversation

@jnurthen
Copy link
Copy Markdown
Contributor

@jnurthen jnurthen commented Feb 10, 2022

Closes #2529
Closes #3260

This concludes the high contrast PRs

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

Turn on WHCM
Run Storybook for the following components:

  • Date and Time -> Calendar
  • Date and Time -> Date Range Picker
  • Checkbox
  • ColorSlider, ColorThumb, ColorWheel
  • Picker
  • Combobox
  • MenuTrigger
  • Radio Group
  • Slider
  • NumberField
  • TextField
  • TextArea
  • Switch

Screenshots

Calendar

Before

Screen Shot 2022-02-10 at 4 09 01 PM

#### After

Screen Shot 2022-02-10 at 4 09 33 PM

Date Range

Before

Screen Shot 2022-02-10 at 4 16 01 PM

#### After

Screen Shot 2022-02-10 at 4 14 52 PM

Checkbox

After (compare to XD design)

Screen Shot 2022-02-17 at 3 19 54 PM

Color Components

Before

Screen Shot 2022-02-17 at 3 23 33 PM

Screen Shot 2022-02-17 at 3 24 10 PM

#### After

Screen Shot 2022-02-17 at 3 23 48 PM

Screen Shot 2022-02-17 at 3 24 27 PM

Combobox

After (compare to XD)

Screen Shot 2022-02-17 at 3 26 10 PM

Switch

After (compare to XD)

Screen Shot 2022-02-17 at 3 27 53 PM

NumberField

Before

Screen Shot 2022-02-17 at 3 30 47 PM

#### After

Screen Shot 2022-02-17 at 3 31 05 PM

Slider

Before

Screen Shot 2022-02-17 at 3 32 55 PM

After

Screen Shot 2022-02-17 at 3 32 40 PM

Radio Group

Before

Screen Shot 2022-02-17 at 3 29 53 PM

#### After

Screen Shot 2022-02-17 at 3 29 33 PM

@jnurthen jnurthen marked this pull request as ready for review February 17, 2022 23:44
&.is-invalid {
.spectrum-Checkbox-box {
&:before {
border-color: var(--spectrum-checkbox-box-border-color);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This conflicts with var(--spectrum-checkbox-box-border-color-error) above. Is the intended border color Highlight or ButtonText?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is intended to be ButtonText when unselected and Highlight when selected according to the XD
Checkbox (Windows high contrast mode) UI kit

--spectrum-checkbox-text-color-error-down: FieldText;
--spectrum-checkbox-text-color-error-hover: FieldText;

&.is-invalid {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer if we can only override variables and not re-define selectors if possible. I think most of this seems unnecessary because the vars are already overridden above?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variables as defined assume the same border colour for :checked.
I don't think I can do this without modifying

.spectrum-Checkbox.is-invalid {
  /* Extra-specific selectors added here to handle checked state */
  .spectrum-Checkbox-input:checked + .spectrum-Checkbox-box,
  .spectrum-Checkbox-box {
    &:before {
      border-color: var(--spectrum-checkbox-box-border-color-error);
    }
  }

in lines 158-165 where the same colour is used for checked and unchecked.
I could add a new variable there and split that selector. Would that be better?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@devongovett is that the direction you would like me to go?

Comment thread packages/@adobe/spectrum-css-temp/components/dropdown/skin.css
Comment thread packages/@adobe/spectrum-css-temp/components/dropdown/skin.css
Comment thread packages/@adobe/spectrum-css-temp/components/inputgroup/skin.css Outdated
Comment thread packages/@adobe/spectrum-css-temp/components/stepper/skin.css
Comment thread packages/@adobe/spectrum-css-temp/components/textfield/skin.css Outdated
}


}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Firefox, the disabled state looks wrong. It has a white background. Seems ok in edge/chrome though.

Also, the invalid/valid icons in Firefox are still red/green rather than white.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Firefox doesn't support forced-color-adjust:none at the moment. To be honest I don't think we have a hope of supporting FF in high contrast until they do unless I simplify the spectrum defined high contrast behaviour.

I'm ok with either direction but as far as I know the high contrast usage with FF is not very high.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@devongovett are we looking to support FF in WHCM?

Copy link
Copy Markdown
Member

@devongovett devongovett Apr 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to follow your lead there. If it's easy to support, then great, but if it's not possible or a lot of additional work for not much benefit than it's fine with me if we don't. We should just note that so that when we test it's understood which browsers we should be testing.

Comment thread packages/@adobe/spectrum-css-temp/components/toggle/skin.css Outdated
Comment thread packages/@adobe/spectrum-css-temp/components/calendar/skin.css
@majornista
Copy link
Copy Markdown
Collaborator

GET_BUILD

1 similar comment
@LFDanLu
Copy link
Copy Markdown
Member

LFDanLu commented Jun 20, 2022

GET_BUILD

@adobe-bot
Copy link
Copy Markdown

@majornista majornista self-requested a review June 23, 2022 17:19
Comment thread packages/@adobe/spectrum-css-temp/components/calendar/skin.css
@LFDanLu
Copy link
Copy Markdown
Member

LFDanLu commented Jun 24, 2022

Are there XDs for Calendar/DateRange WHCM? I've looked on Spectrum/contributions but couldn't find any. If not thats fine, I've been trying to watch out for any style ambiguities

@jnurthen
Copy link
Copy Markdown
Contributor Author

Are there XDs for Calendar/DateRange WHCM? I've looked on Spectrum/contributions but couldn't find any. If not thats fine, I've been trying to watch out for any style ambiguities

No. I don't believe there are up to date XDs for non high contrast mode for this component either.

@LFDanLu
Copy link
Copy Markdown
Member

LFDanLu commented Jun 24, 2022

GET_BUILD

@adobe-bot
Copy link
Copy Markdown

}
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed the following when testing the Calendar/DateRangePicker WHCM. Lemme know if these are as expected due to color limitations or if they aren't/won't be handled in this PR:

  1. Can't see that the user is currently focused on the datepicker button:
    focusOnButton
    vs

image

  1. The current date (aka the 24th) styling is overridden when the range includes it
    currentDayInRange
    vs

image

  1. The invalid colors are inconsistent between the date range, the validation icons, and the border/focus ring of the input field. The invalid color in the calendar in particular are hard to see on the black blackground (perhaps a limitation of WHCM theming since there isn't an error color?)
    Invalid
    vs

image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Working on this.
  2. I think this is an acceptable compromise. With limited colours knowing today is optional IMO. The colour in the default scheme doesn't meet WCAG so if we insist knowing today is required then we need to fix outside high contrast mode too.
  3. These variables were introduced after I created this PR. I'm adding these new invalid variables which will look identical to a selection. The error message is the way you tell that there is an error

Copy link
Copy Markdown
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some additional things from testing, I'd be happy to approve and handle these in a follow up if you'd like. Apologies for the much delayed review and thank you for working on this!

Comment thread packages/@adobe/spectrum-css-temp/components/inputgroup/skin.css Outdated
Comment thread packages/@adobe/spectrum-css-temp/components/inputgroup/skin.css Outdated
Comment thread packages/@adobe/spectrum-css-temp/components/toggle/skin.css
Comment thread packages/@adobe/spectrum-css-temp/components/slider/skin.css
Comment thread packages/@adobe/spectrum-css-temp/components/radio/skin.css
jnurthen and others added 8 commits June 27, 2022 15:15
@LFDanLu
Copy link
Copy Markdown
Member

LFDanLu commented Jul 18, 2022

GET_BUILD

@adobe-bot
Copy link
Copy Markdown

Copy link
Copy Markdown
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, tested again in Windows Chrome, thanks for the fixes!

@dannify dannify merged commit 4ae6f5f into adobe:main Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

WHCM / forced-colors support missing in useDatePicker, RangeCalendar Support for Windows High Contrast Themes

7 participants