Skip to content

Disable elements when color picker is disabled #591

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

Merged
merged 11 commits into from
Oct 11, 2023

Conversation

bjarnef
Copy link
Contributor

@bjarnef bjarnef commented Oct 2, 2023

Description

When Color Picker component was set to disabled, in only disabled input, but not color area, hue + opacity slider, eye dropper.

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (minor updates related to the tooling or maintenance of the repository, does not impact compiled assets)

Motivation and context

How to test?

Screenshots (if appropriate)

Checklist

  • If my change requires a change to the documentation, I have updated the documentation in this pull request.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

@github-actions
Copy link

github-actions bot commented Oct 2, 2023

Hi there @bjarnef, thank you for this contribution! 👍

While we wait for the team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:

  • It's clear what problem this is solving, there's a connected issue or a description of what the changes do and how to test them
  • The automated tests all pass (see "Checks" tab on this PR)
  • The level of security for this contribution is the same or improved
  • The level of performance for this contribution is the same or improved
  • Avoids creating breaking changes; note that behavioral changes might also be perceived as breaking
  • If this is a new feature, Umbraco HQ provided guidance on the implementation beforehand
  • 💡 The contribution looks original and the contributor is presumably allowed to share it

Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution.

If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@bjarnef
Copy link
Contributor Author

bjarnef commented Oct 2, 2023

@loivsen @iOvergaard this disable the other parts in color picker, when Color Picker disabled attribute is set.

When color swatch is set the disabled I guess it shouldn't be selectable? Currently I can still make a selection even swatch has disabled attribute.

It is now possible to set disabled on color swatches as well.

When color swatch is disabled I think we need to indicate this as well like with color area and color slider.
I have added some transparency.

@bjarnef
Copy link
Contributor Author

bjarnef commented Oct 2, 2023

Remember the hacktoberfest/contrib-2023 label 😁😎😍

@loivsen
Copy link
Contributor

loivsen commented Oct 2, 2023

I think it would make sense to have it unselectable if disabled, similar to uui-radio.
Could you make a quick story for the color picker when disabled? 😊

@bjarnef
Copy link
Contributor Author

bjarnef commented Oct 2, 2023

I have added a story for color picker when disabled when inline and with opacity.

image

The color swatches are selectable at the moment though.

@bjarnef
Copy link
Contributor Author

bjarnef commented Oct 2, 2023

@loivsen I think it's a bit different with uui-radio because it's a native form input and doesn't using SelectableMixin.

But I think it here it need to set selectable and deselectable to false no matter it uui-swatch has selecable attribute.
If it is disabled it shouldn't be possible to select or deselect it.

if (this.selectable) {
this.selectable = !this.disabled;
this.deselectable = !this.disabled;
}

@loivsen
Copy link
Contributor

loivsen commented Oct 9, 2023

@bjarnef It looks like you can still select colors via uui-swatches thus also in the color-picker. uui-swatch seems to work fine. The swatches should hopefully be the last thing to be fixed before we can merge it in 😊

@bjarnef
Copy link
Contributor Author

bjarnef commented Oct 10, 2023

@loivsen should be fixed now in 826b4b9

I also updated so swatch inherit the cursor style from host element, so not-allowed when disabled.
I think there could be some base styling imported to components to ensure consistency and we don't need to write same styling in multiple components.

If <uui-color-swatches> is set to disabled, it doesn't make much sense that <uui-swatch> can has disabled="false". I have set it both placed, but is think we can remove the attribute from swatch in color picker component, and handle is dynamically in swatches component.

chrome_Ao4nalr6up.mp4

@bjarnef
Copy link
Contributor Author

bjarnef commented Oct 10, 2023

Fixed so when don't need to set disabled attribute on swatch in color picker as it is added on swatches:
1e47834

and swatches component set disabled attribute on each swatch here:
https://github.com/umbraco/Umbraco.UI/pull/591/files#diff-8090b44f925ed46b626e45b3d05f30d71d493772a9ddf02effbb81f86c088475R93

I think the selectable attribute doesn't care about the value and if the attribute is added to an element, it is selectable.

@loivsen loivsen enabled auto-merge October 11, 2023 13:29
@loivsen loivsen merged commit fc61c8b into umbraco:v1/contrib Oct 11, 2023
@umbrabot
Copy link

Hi there @bjarnef!

First of all: A big #H5YR for making an Umbraco related contribution during Hacktoberfest! We are very thankful for the huge amount of PRs submitted, and all the amazing work you've been doing 🥇

Due to the amazing work you and others in the community have been doing, we've had a bit of a hard time keeping up. 😅 While all of the PRs for Hacktoberfest might not have been merged yet, you still qualify for receiving some Umbraco swag, congratulations! 🎉

In the spirit of Hacktoberfest we've prepared some exclusive Umbraco swag for all our contributors - including you!

As an alternative choice this year, you can opt-out of receiving anything and ask us to help improve the planet instead by planting a tree on your behalf. 🌳

Receive your swag or plant a tree! 👈 Please follow this link to fill out and submit the form, before December 15th, 2022, 23:59:00 UTC.

Following this date we'll be sending out all the swag, but please note that it might not reach your doorstep for a few months, so please bear with us and be patient 🙏

📢 We have just published a summary of all the activity throughout this year's Umbraco Hacktoberfest.

The only thing left to say is thank you so much for participating in Hacktoberfest! We really appreciate the help!

Kind regards,
The various Umbraco teams.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants