Skip to content

Commit

Permalink
fix(md): item border has improved contrast in dark mode (#29398)
Browse files Browse the repository at this point in the history
Issue number: resolves #29386

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

The item border does not have sufficient contrast in dark mode making
the border almost invisible.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Removed the `--ion-border-color` in the MD dark palette. Instead,
we're using the [theme
default](https://github.com/ionic-team/ionic-framework/blob/dc1172a8411f71227b713a6d7addca91537ea438/core/src/themes/ionic.theme.default.md.scss#L31).
## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->


The earliest reference to the offending line Brandy and I could find was
[here](#18713 (comment)).
  • Loading branch information
liamdebeasi committed Apr 29, 2024
1 parent c4b98ff commit fa85f03
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 1 deletion.
29 changes: 29 additions & 0 deletions core/src/components/item/test/a11y/item.e2e.ts
Expand Up @@ -2,6 +2,35 @@ import AxeBuilder from '@axe-core/playwright';
import { expect } from '@playwright/test';
import { configs, test } from '@utils/test/playwright';

configs({ directions: ['ltr'], palettes: ['dark'] }).forEach(({ config, screenshot, title }) => {
test.describe(title('item: dark palette'), () => {
/**
* This test was originally created to ensure the item border has sufficient
* contrast. We don't use an Axe test here because Axe not warn about color
* contrast on the item borders.
*/
test('borders should have sufficient contrast', async ({ page }) => {
test.info().annotations.push({
type: 'issue',
description: 'https://github.com/ionic-team/ionic-framework/issues/29386',
});
await page.setContent(
`
<ion-list>
<ion-item>Item</ion-item>
<ion-item>Item</ion-item>
</ion-list>
`,
config
);

const list = page.locator('ion-list');

await expect(list).toHaveScreenshot(screenshot(`item-dark`));
});
});
});

configs({ directions: ['ltr'] }).forEach(({ config, screenshot, title }) => {
test.describe(title('item: axe'), () => {
test('should not have accessibility violations', async ({ page }) => {
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion core/src/css/palettes/dark.scss
Expand Up @@ -142,7 +142,6 @@ $colors: (
--ion-background-color-rgb: 18, 18, 18;
--ion-text-color: #ffffff;
--ion-text-color-rgb: 255, 255, 255;
--ion-border-color: #222222;
--ion-background-color-step-50: #1e1e1e;
--ion-background-color-step-100: #2a2a2a;
--ion-background-color-step-150: #363636;
Expand Down

0 comments on commit fa85f03

Please sign in to comment.