User tests: Successful: Unsuccessful:
Due to some complications, the previous commit didn't work.
Pull Request for Issue #32494.
Demo page of the color-picker component right here.
minicolors
assetstinycolor
assetjoomla-field-color-picker.es6.js
as described in #32494layouts/joomla/form/field/color/advanced.php
fileJavaScript Testing
The most important test for me, please report any error in the console along with the following info:
Existing Extensions Testing
<field type="Color"
control="advanced">
field;<color-picker>
updates the background of the visible input with the value stored in the database; if not the script is missing, not initialized or something happened, see below;ColorPicker
or TinyColor
related errors; Report back here any error you encounter; I really hope there won't be;.color-dropdown
then click anywhere outside of it, the .color-dropdown
should close;.color-dropdown
element is visible try and resize the window, see if the console pops any error;.color-dropdown
element is rendered (above or below the visible input), then scroll the window up/down while open to check if the .color-dropdown
element should be re-positioned where it has the most available space;Color Picker Options Testing
/templates/cassiopeia/templateDetails.xml
, find the <fieldset name="advanced">
tag and paste inside the following code:<field
name="advanced-color-hex"
type="Color"
format="hex"
keywords="false"
hint="Type in a valid hexadecimal colour value"
default="#069"
label="Text Color" />
<field
name="advanced-color-rgb"
type="Color"
required="true"
format="rgb"
default="rgb(0,102,153)"
label="Primary Color" />
<field
name="advanced-color-hsl"
type="Color"
required="true"
format="hsl"
keywords="navy,lime,crimson,chocolate"
default="hsla(265,100%,50%,.8)"
label="Secondary Color" />
<field name="advanced-color-hex">
sets the keywords="false"
which disables the usage of presets and restricts the color-picker to only use format="hex"
colors (in this particular case); the reason for this behavior is the need to send SCSS compilers real and valid HEX/RGB(a)/HSL(a) color values to be used for mixins, eg. darken($primary,15%)
(darken('inherit',15%)
won't work); this field should use a placeholder;<field name="advanced-color-rgb">
does not set the keywords
option and will use the default keywords: transparent
, curentColor
, initial
and inherit
; as a result, the color-picker will display a button on the right side of the visible input to open a color options menu; these "non-color" values are valid CSS values; this field is required;<field name="advanced-color-hsl">
sets the keywords="navy,crimson.."
and enables the usage of user defined presets based on web safe color names; because none of the above "non-color" keywords is present in the setting value, color-picker will again restrict values to only valid HSL(a) format colors for the same known reasons.Keyboard Events Testing
.color-dropdown
is displayed, hit the ESC key of your keyboard, it should close/hide the element;<field type="Color">
, try and navigate the page with your keyboard, when you focus a color-picker it should open its .color-dropdown
and allow you to navigate inside;<field type="Color" keywords="false">
delete the current value in the visible input first then try typing "inherit", "transparent" or "currentColor", it should set #000000
value;<field type="Color" keywords="navy,crimson..">
delete the current value in the visible input first then try typing "inherit", "transparent" or "currentColor", it should set a valid HEX/RGB(a)/HSL(a) value;<field type="Color">
which uses no keywords
option. delete the current value in the visible input first then try typing "inherit", "transparent" or "currentColor", it should set that value;.color-dropdown
(where format is either "rgb" or "hsl"), focus one of them and try and change values by using the up/down buttons of the keyboard, it should instantly update the color picker on every change;.color-dropdown
(where format is either "rgb" or "hsl"), focus one of them and try and type 0-255 for "R", "G" or "B" for the <field type="Color" format="rgb">
field or 0-359 for "H", 0-100 for "S" or "L" for the <field type="Color" format="hsl">
, it should update the color picker on every change after a short delay (TinyColor will validate that color first);<field type="Color" format="hsl">
, if the "L" (Lightness component) is 100, the "S" (Saturation component) and the "H" (Hue component) both should be locked at 0, then decrease lightness to 99 and this will unlock Saturation control, ultimately if you set Lightness to less than 100 and Saturation to at least 1, this will ultimately unlock Hue control (this will be explained in the documentation).Testing the "onchange"
The implementation is similar with fancy-select, so you as tester, as well as third party devs should have a familiar feeling about color picker. For any of your <field type="Color" control="advanced">
make sure to also test "onchange":
Mobile Testing
.color-dropdown
and the mobile keyboard all are displayed on the mobile device screen; the color-picker will decrease its height by around 25% to fit most mobile devices;.color-dropdown
popup on taping outside the element itself;Accessibility Testing
Check the labels of all the visible inputs, find any ARIA related issues, report back anything you think it's not good enough in terms of accessibility, ARIA and so on.
The main focus:
<joomla-field-color-picker>
element is focused, hit Enter
/Space
to toggle the color picker visibilityTab
key, it should go to the next form fieldTab
key, it should navigate all focusable elementsAll type="color"
fields that use control="advanced"
are outdated in terms of accessibility, usability and jQuery dependency.
All your type="Color"
fields that use control="advanced"
are super awesome on any device and any user.
This documentation section mentions nothing about the control property/setting of the Color
field, the following is a draft to provide guidance for this Joomla form field type as coded in libraries\src\Form\Field\ColorField.php
in Joomla 4.0. Some parts of it need to be updated by their developer or some Joomla intern knowledgeable of this particular form field.
Documentation Draft
Provides a flexible form field that allow you to set a colour, with controls ranging from simple to advanced.
colors="#ff0000,#0000ff"
.keywords="initial,inherit,currentColor,transparent"
, however you can disable the feature by using keywords="false"
which will restrict the color picker to only use valid HEX, RGB(a) or HSL(a) values. If you include any of the default value (eg. "inherit") in the keywords list, it will remove the restriction.Note on HSL(a) Format and Advanced Control
TinyColor is the script behind the color picker of the "advanced" control. This script will understand that values like hsl(0, 0%, 100%)
and hsl(150, 0%, 100%)
are visually identical, it will use the hsl(0, 0%, 100%)
value. In addition, if the L (Lightness component) is 100% then the S (Saturation component) and the H (Hue component) both should be locked at 0 in the inputs of the color picker; if you decrease Lightness to 99% it will unlock Saturation control, ultimately if you set Lightness to less than 100% and Saturation to at least 1%, this will unlock Hue control.
Example XML Definition for Simple Control:
<field name="backgroundcolor"
type="Color"
format="hex"
default="#ff0000"
control="simple"
colors="#ff0000,#008000,#0000ff"
label="TPL_BEEZ3_FIELD_HEADER_BACKGROUND_COLOR_LABEL"
description="TPL_BEEZ3_FIELD_HEADER_BACKGROUND_COLOR_DESC" />
Example XML Definition for Slider Control: (this part need to be updated by its developer)
<field name="backgroundcolor"
type="Color"
default="#ff0000"
format="hex"
control="slider"
display="hue"
label="TPL_BEEZ3_FIELD_HEADER_BACKGROUND_COLOR_LABEL"
description="TPL_BEEZ3_FIELD_HEADER_BACKGROUND_COLOR_DESC" />
Example XML Definition for Advanced Control:
<field name="backgroundcolor"
type="Color"
format="rgb"
control="advanced"
default="rgb(250,0,0)"
keywords="initial,inherit,transparent,navy,lime"
label="TPL_BEEZ3_FIELD_HEADER_BACKGROUND_COLOR_LABEL"
description="TPL_BEEZ3_FIELD_HEADER_BACKGROUND_COLOR_DESC" />
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_admin Language & Strings Templates (admin) NPM Change JavaScript Repository Layout Front End Templates (site) |
still DART-SASS issue
That's weird. The SASS package is the one that is defined in the package.json on the root of the repo and it doesn't throw any errors for the same files. Maybe an app like https://www.sourcetreeapp.com can help you here (figure out the point that your branch is created, normally if this is a new PR that should be the tip of the 4.1-dev.)
Probably changing the SCSS sources too much will result in the issue, but I found another problem.
In my local repository, I didn't do the composer install
action yet and npm install
will always fail because many scss files from templates import stuff from the media folder which doesn't exist, which makes me think the official 4.1-dev
branch is missing something. Something that I didn't have to deal with when I previously commited to 4.0-dev
branch before.
I didn't do the composer install action yet
The composer install needs to be done before the npm install. That's expected
Something isn't right.
EDIT: I just did a composer install
then npm install
and got the exact same error as the online build testing.
I think something is wrong with the 4.1-dev
build.
EDIT 2: it must be related to what @brianteeman said yesterday, there were some files changed unrelated to my commit.
Guys, I can nail down these pesky SCSS issues real quick ($font-size: $some-var / 2
=> $font-size: $some-var * .5
). I think it's the expected SCSS format in the future and probably SCSS lint will also consider that in the future.
Just let me know.
@thednp please make another PR that will change the division according to SASS docs: https://sass-lang.com/documentation/breaking-changes/slash-div
So your example
$font-size: $some-var / 2;
should be written as:
$font-size: math.div($some-var, 2);
That won't work with our medialize/sass
unfortunately. and Bootstrap devs still count on it, see their variables.scss. My solution I posted above is the better one, for now, at least for the front-end side of things, since the back-end SCSS is compiled on build via node_modules/sass
(dart-sass).
@dgrammatiko 5min into the job: $fa-fw-width: (20em / 16);
file joomla-cms\media\vendor\fontawesome-free\scss_variables.scss as well as font-awesome repository.
Do we fix/resolve 3rd party code quality?
Do we fix/resolve 3rd party code quality?
Not in this repo. We can either do a PR to their repo or wait till someone else fixes it...
We can just override the value with $fa-fw-width: (20em * .0625);
(width * 1/16).
For instance joomla-cms\build\media_source\com_media\scss\components_media-infobar.scss overrides $fa-css-prefix: fa;
We can just override the value with $fa-fw-width: (20em * .0625); (width * 1/16)
If you can override it then should be fine, we already overriding the path, etc
We may have to override the entire variables.scss
file because $fa-fw-width
is not marked with !default
and the compiler does not like it.
You can not remove the minicolors css or js as they may be used by extensions and they have not been marked as deprecated
So instead of removing minicolors assets and references in the asset json files, we have our color-picker separate?
So instead of removing minicolors assets and references in the asset json files, we have our color-picker separate?
No that's not what Brian meant. The js+css needs to be in the media/vendor folder but not in the assets.josn. Basically you need to revert some of the changes in the build/settings.json...
Labels |
Added:
Language Change
NPM Resource Changed
?
|
Category | Administration com_admin Language & Strings Templates (admin) NPM Change JavaScript Repository Layout Front End Templates (site) | ⇒ | Administration Language & Strings Templates (admin) NPM Change Repository JavaScript Layout Front End Plugins Templates (site) |
Category | Administration Language & Strings Templates (admin) NPM Change JavaScript Repository Layout Front End Templates (site) Plugins | ⇒ | Administration Language & Strings Templates (admin) NPM Change Repository JavaScript Layout Front End Templates (site) |
@dgrammatiko I've changed most things as you advised, please take a minute to check.
Thanks @PhilETaylor
Category | Administration Language & Strings Templates (admin) NPM Change JavaScript Repository Layout Front End Templates (site) | ⇒ | Administration Language & Strings Repository NPM Change JavaScript Layout |
@dgrammatiko man, I put back minicolors and still no go. I think the problem is very much related to the build/media_source/system/scss/fields/joomla-field-color-picker.scss.
It may be a problem with the SCSS + JS compile function in the build
folders.
@thednp has nothing to do with your code, the failure is in bootstrap.scss
FWIW if you apply both the PRs from #35639 (comment) CI will be fine
Alright buddy, what about my fixes in #35648?
That is valid (I think I'm not a SCSS person)
Also, any news on the TinyMCE improvements?
There will be a POC PR today, I'm just trying to introduce all the changes without an B/C breaks or a bazzilion of cryptic options
Alright buddy, what about my fixes in #35648?
That is valid (I think I'm not a SCSS person)
To my research, those fixes are absolutely needed in dart-sass 2.0, it would be a waste of somebody's time someday to find and nail them down like I did.
Also, any news on the TinyMCE improvements?
There will be a POC PR today, I'm just trying to introduce all the changes without an B/C breaks or a bazzilion of cryptic options
Sweet, please tag me in.
This pull request has automatically rebased to 4.2-dev.
This pull request has been automatically rebased to 5.0-dev.
This pull request has been automatically rebased to 5.1-dev.
This pull request has been automatically rebased to 5.2-dev.
Title |
|
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-06-22 06:58:19 |
Closed_By | ⇒ | thednp | |
Labels |
Added:
Feature
PR-5.0-dev
PR-5.2-dev
Removed: ? |
@dgrammatiko this is a completely rebased commit, still DART-SASS issues. As you can see, all changes are all about removing minicolors and replacing it with our color-picker. There is nothing wrong here.