User tests: Successful: Unsuccessful:
Due to some complications, the previous commits #32508 and #32510 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 Repository JavaScript Layout Front End Templates (site) |
Labels |
Added:
Language Change
NPM Resource Changed
?
|
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-09-22 10:51:05 |
Closed_By | ⇒ | thednp |