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

Color Generator not updating main color when replacing with a value without hashtag #1507

Closed
noahhorlacher opened this issue Jun 25, 2020 · 3 comments · Fixed by #2904
Closed
Labels
bug Issues related to bugs on the documentation website

Comments

@noahhorlacher
Copy link

noahhorlacher commented Jun 25, 2020

Describe the bug
On the ionic color generator page, the corresponding '-shade' and '-tint' sub-variables don't update when replacing a hexcode in the main variable input fields with a value missing the hashtag.

To reproduce
Steps to reproduce the behavior:

  1. Go to 'https://ionicframework.com/docs/theming/color-generator'
  2. Click on the arrow to the right of any color input field such as 'Primary' to see the sub-variables
  3. Select the current value (click on the input field and press CTRL+A) including the hashtag
  4. Paste a hex code value missing the hashtag e.g. ff0000
  5. The site auto-inserts the hashtag at the beginning, but doesn't auto-update the colors and values of the sub-variables, until you type in another character. It also doesn't update if it's not in focus anymore.

Expected behavior
After the site prepends a hashtag to the value, it's expected to auto-update the sub-variables.

Screenshots
screenshot

Browser and OS

  • OS: Ubuntu 20.04 LTS
  • Browser: Firefox, Google Chrome
  • Version: 77.0.1, 83.0.4103.116
@noahhorlacher noahhorlacher added the bug Issues related to bugs on the documentation website label Jun 25, 2020
@acran
Copy link
Contributor

acran commented Jul 7, 2020

I tracked down the reason for this to this block:

if (input.matches('[type="text"]') && val[0] !== '#') {
input.value = '#' + val;
return;
}

The fix should be to simply drop the return since it will still ensure that the input starts with a # and if it not yet a valid input (i.e. 7 characters long) it will be skipped by the subsequent check anyway:

if (input.matches('[type="text"]') && val.length !== 7) { return; }

It would also need to update val, too, and declaring it with let instead of const. So the fixed code would be:

    let val = input.value.trim();

    if (input.matches('[type="text"]') && val[0] !== '#') {
      input.value = '#' + val;
      val = input.value;
    }

@liamdebeasi liamdebeasi added triage New issues and removed bug Issues related to bugs on the documentation website labels Sep 20, 2022
@averyjohnston
Copy link
Contributor

Thank you for the issue. Taking a look at the newest version of the docs, the bug mentioned here no longer occurs -- the shade and tint colors update as expected -- but now there's a slightly different issue: the main color doesn't update. It would be good if we could get these working consistently with each other.

main color

@averyjohnston averyjohnston added the bug Issues related to bugs on the documentation website label Jan 13, 2023
@ionitron-bot ionitron-bot bot removed the triage New issues label Jan 13, 2023
@averyjohnston averyjohnston changed the title Color Generator not updating -shade and -tint when replacing with a value without hashtag Color Generator not updating main color when replacing with a value without hashtag Jan 13, 2023
@averyjohnston
Copy link
Contributor

Latest iteration of the issue (see my previous comment) resolved via #2904. Thanks again for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues related to bugs on the documentation website
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants