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

Add WHCM support for all the form elements #2830

Merged
merged 50 commits into from Jul 19, 2022
Merged

Conversation

jnurthen
Copy link
Member

@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 Feb 17, 2022
&.is-invalid {
.spectrum-Checkbox-box {
&:before {
border-color: var(--spectrum-checkbox-box-border-color);
Copy link
Member

@devongovett devongovett Mar 12, 2022

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
Member Author

@jnurthen jnurthen Mar 17, 2022

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
Member

@devongovett devongovett Mar 12, 2022

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
Member Author

@jnurthen jnurthen Mar 17, 2022

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
Member Author

@jnurthen jnurthen Mar 21, 2022

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?

}


}
Copy link
Member

@devongovett devongovett Mar 12, 2022

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
Member Author

@jnurthen jnurthen Mar 18, 2022

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
Member Author

@jnurthen jnurthen Mar 21, 2022

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
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.

@majornista
Copy link
Collaborator

@majornista majornista commented Jun 20, 2022

GET_BUILD

1 similar comment
@LFDanLu
Copy link
Member

@LFDanLu LFDanLu commented Jun 20, 2022

GET_BUILD

@adobe-bot
Copy link

@adobe-bot adobe-bot commented Jun 20, 2022

@majornista majornista self-requested a review Jun 23, 2022
@LFDanLu
Copy link
Member

@LFDanLu 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
Member Author

@jnurthen jnurthen 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

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

@LFDanLu
Copy link
Member

@LFDanLu LFDanLu commented Jun 24, 2022

GET_BUILD

@adobe-bot
Copy link

@adobe-bot adobe-bot commented Jun 24, 2022

@@ -151,3 +151,53 @@ governing permissions and limitations under the License.
}
}
}

Copy link
Member

@LFDanLu LFDanLu Jun 24, 2022

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
Member Author

@jnurthen jnurthen Jun 30, 2022

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
Member

@LFDanLu LFDanLu left a comment

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!

jnurthen and others added 8 commits Jun 27, 2022
In order to reproduce the overlapping gradients for a ColorArea, the container element .spectrum-ColorArea will have a background-image or background-color over which the .spectrum-ColorArea-gradient renders.
@LFDanLu
Copy link
Member

@LFDanLu LFDanLu commented Jul 18, 2022

GET_BUILD

@adobe-bot
Copy link

@adobe-bot adobe-bot commented Jul 18, 2022

Copy link
Member

@LFDanLu LFDanLu left a comment

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

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