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

Wcag color a11y tool #683

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

amy-corson-ibigroup
Copy link
Contributor

Adds a wcag color contrast tool on the color palette component.
Also, fixes an issue where story docs were getting exported to npm

image

@@ -9,6 +9,7 @@
"module": "esm/index.js",
"private": false,
"dependencies": {
"color-contrast": "^1.0.0",
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are already some methods in core-utils that do this! No need for an extra library

Copy link
Collaborator

@miles-grant-ibigroup miles-grant-ibigroup left a comment

Choose a reason for hiding this comment

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

Screenshot 2023-12-21 at 9 03 37 AM seeing some weird things going on in the stories list. those sub-stories don't work either.

Why are snapshots being updated? I think we can add these new stories to the ignore list.

const [foregroundError, setForegroundError] = useState(false);
const [backgroundError, setBackgroundError] = useState(false);

const REX_EXP = /(^#[0-9A-F]{6}$)/i;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh my god

can we at least name this HEX_REGEXP?

Comment on lines +109 to +111
let hexcode = code;
if (!code.startsWith("#")) hexcode = `#${code}`;
return REX_EXP.test(hexcode);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could this not be cleaner as

Suggested change
let hexcode = code;
if (!code.startsWith("#")) hexcode = `#${code}`;
return REX_EXP.test(hexcode);
return REX_EXP.test(hexcode) || REX_EXP.test(`#${code}`);

};

const backgroundHandleChange = event => {
const value = event.target.value;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could this be cleaner as

Suggested change
const value = event.target.value;
const { value } = event.target;

Comment on lines +145 to +167
useEffect(() => {
if (selectedColorReset) {
setSelectedColor(undefined);
}
if (!isValidHexCode(foregroundColorInput)) {
setForegroundError(true);
} else {
setForegroundError(false);
setForegroundColor(foregroundColorInput);
}
}, [foregroundColorInput]);

useEffect(() => {
if (selectedColorReset) {
setSelectedColor(undefined);
}
if (!isValidHexCode(backgroundColorInput)) {
setBackgroundError(true);
} else {
setBackgroundError(false);
setBackgroundColor(backgroundColorInput);
}
}, [backgroundColorInput]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this in here twice? Also, how is this using variables that aren't in the variable array?

@miles-grant-ibigroup
Copy link
Collaborator

Some of this will be fixed by #726. Let's block this until 726 is merged

@miles-grant-ibigroup miles-grant-ibigroup added the BLOCKERS Blockers exist outside of otp-ui (e.g., backend, service, etc...) label Mar 18, 2024
@amy-corson-ibigroup amy-corson-ibigroup removed their assignment Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BLOCKERS Blockers exist outside of otp-ui (e.g., backend, service, etc...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants