Conflicting Files NPM Resource Changed ? Pending

User tests: Successful: Unsuccessful:

avatar brianteeman
brianteeman
10 Jun 2019

With the dropping of support for IE11 we can now finally start to use more browser native functionality. This PR completely drops the existing javascript solutions for a colour picker and replaces them all with a pure native html 5 colour picker. Unlike the current (broken) colourpickers this requires almost zero support or technical skills to maintain.

Javascript (ES5, ES6, jQuery)

No javascript is used!!

Accessibility

The colourpicker is completely accessible across all devices and browsers and when using any assistive technology. We don't need to do anything to maintain this accessibility as the browsers do it for us.

Translation

The colourpicker is completely localised across all devices and browsers. We don't need to do anything to maintain the translations as the browsers do it for us.

Colourpicker display

No code - it's all from the browser. This ensures a familiar ui. As more software drops IE support it will become even more familiar as everyone stops using external scripts

Field Display

As well as adding some styling to the button to make it visibly consistent I have added a text representation of the color - see ToDo for further improvement suggestions

Breaking change

Only supports RGB and HSL colours. RGBA is not supported but it has been broken for a long time with no sign of any interest in fixing it

Advantages

  • almost zero maintenance
  • removes a jquery dependency
  • removes a 3pd script
  • removes (unmaintainable) code
  • familiar ui
  • completely accessible
  • responsive
  • great on mobile
  • zero translation

Disadvantages

  • Does not support transparency or opacity
  • UI is not consistent across devices

ToDo - (help would be awesome)

[ ] The code blocks in the color field plugin need updating
[ ] Text representation of the selected colour only updates on save not change/selection
[ ] It would be a bonus if the text representation of the colour was a text input so users could enter the value directly

Testing instructions

  1. Apply this PR
  2. Composer install
  3. npm install
  4. Add the following to any form xml (I used administrator\templates\atum\templateDetails.xml )
    <field name="color" type="color" label="Color test field" default="#000000" filter="color" />
  5. OR create a custom colour field
248e084 10 Jun 2019 avatar brianteeman color
avatar brianteeman brianteeman - open - 10 Jun 2019
avatar brianteeman brianteeman - change - 10 Jun 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 10 Jun 2019
Category Administration Templates (admin) Repository JavaScript NPM Change Layout Libraries Front End Templates (site)
avatar brianteeman brianteeman - change - 10 Jun 2019
Labels Added: NPM Resource Changed ?
avatar joomla-cms-bot joomla-cms-bot - change - 10 Jun 2019
Category Administration Templates (admin) Repository JavaScript NPM Change Layout Libraries Front End Templates (site) Administration Templates (admin) Repository JavaScript NPM Change Layout Front End Templates (site)
ffc9289 10 Jun 2019 avatar brianteeman field
0c394f9 10 Jun 2019 avatar brianteeman merge
avatar joomla-cms-bot joomla-cms-bot - change - 10 Jun 2019
Category Administration Templates (admin) Repository JavaScript NPM Change Layout Front End Templates (site) Administration Templates (admin) Repository JavaScript NPM Change Layout Libraries Front End Templates (site)
avatar brianteeman brianteeman - change - 10 Jun 2019
The description was changed
avatar brianteeman brianteeman - edited - 10 Jun 2019
avatar brianteeman brianteeman - change - 10 Jun 2019
Title
color
[4.0] Colorpicker
avatar brianteeman brianteeman - edited - 10 Jun 2019
avatar ciar4n
ciar4n - comment - 10 Jun 2019

RGBA is not supported but it has been broken for a long time with no sign of any interest in fixing it

How is it broken? Personally I use the format="rgba" attribute on the J3 picker quite extensively and have had no reported issues.

avatar brianteeman
brianteeman - comment - 10 Jun 2019

There are multiple open issues for it

avatar ciar4n
ciar4n - comment - 10 Jun 2019

There are multiple open issues for it

I can only find one related issue and that is unconfirmed (#19187).

avatar C-Lodder
C-Lodder - comment - 11 Jun 2019

I not against this change, but bare in mind that on Android browsers (Chrome, Edge and Opera), it does work, however you cannot input your own HLS or RGB values, nor does it provide you the value. I don't have an iPhone, so can't test on there but assume it would be the same case.

Because of this, I'd strongly suggest having a separate text input next to the colour picker button showing the value of the selected colour, which would only require a few lines of JS

As for the opacity, there are already talks about it: w3c/html#1422

A separate input range can be added in the same layout to support the opacity if need be.

Just something to think about.

avatar brianteeman
brianteeman - comment - 11 Jun 2019

however you cannot input your own HLS or RGB values

You can but only from the sliders

I'd strongly suggest having a separate text input next to the colour picker button showing the value of the selected colour, which would only require a few lines of JS

I agree and it would be useful on all devices thats why I put it on the TODO list

ToDo - (help would be awesome)
[ ] The code blocks in the color field plugin need updating
[ ] Text representation of the selected colour only updates on save not change/selection
[ ] It would be a bonus if the text representation of the colour was a text input so users could enter the value directly

avatar dgrammatiko
dgrammatiko - comment - 13 Jun 2019

@brianteeman according to the n-2 I think you have to hold this pr for at least a year. Safari introduced color picker in this major release...

avatar viocassel
viocassel - comment - 16 Jun 2019

I think the browser native color picker is not enough. Too limited functionality (for now) ...

How about replacing an existing jQuery MiniColors with Pickr? Flat, simple, responsive and hackable Color-Picker library. No dependencies, no jQuery. Compatible with all CSS Frameworks e.g. Bootstrap, Materialize. Supports alpha channel, rgba, hsla, hsva and more!

image

avatar richard67
richard67 - comment - 16 Jun 2019

@viocassel Pickr looks good and seems to be a currently maintained repo. But regarding people it seems to be a one man show. Can we be sure it will be maintained also in future?

avatar brianteeman
brianteeman - comment - 16 Jun 2019

Unfortunately pickr is not accessible at all and its not translatable

avatar Fedik
Fedik - comment - 16 Jun 2019

Currently the color field support 2 mode: simple and hue.
What if introduce another mode (eg native) and use it by default? basically it just a layout switching.
And who have used a simple mode will continue to use it without problem.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 18 Jul 2019
avatar brianteeman
brianteeman - comment - 12 Sep 2019

closing due to lack of interest

avatar brianteeman brianteeman - change - 12 Sep 2019
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2019-09-12 20:32:05
Closed_By brianteeman
avatar brianteeman brianteeman - close - 12 Sep 2019
avatar Simonwep
Simonwep - comment - 4 Feb 2020

@brianteeman i18n support is in progress (Different branch, based on kw-pairs) but currently not implemented in any release. I may not add completely new features in the future but I'll work on bugs and keep it up-to-date as good as possible.

Stumbled across this PR while writing this comment regarding #27538.

avatar brianteeman brianteeman - change - 27 Apr 2020
Status Closed New
Closed_Date 2019-09-12 20:32:05
Closed_By brianteeman
avatar brianteeman brianteeman - change - 27 Apr 2020
Status New Pending
avatar brianteeman brianteeman - reopen - 27 Apr 2020
avatar ceford
ceford - comment - 11 Jul 2020

I noticed that the Color field type in Article Fields does not work. Not complaining - I don't want to use it - just noting the fact.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25162.

avatar roland-d
roland-d - comment - 1 Aug 2020

@brianteeman Any interest in fixing the conflicts and picking this up or should the PR be closed?

avatar brianteeman
brianteeman - comment - 1 Aug 2020

@roland-d no, no interest at all. seems joomla isnt really interested in removing jquery after all or in helping to get this finished

avatar brianteeman brianteeman - close - 1 Aug 2020
avatar brianteeman brianteeman - change - 1 Aug 2020
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2020-08-01 18:20:08
Closed_By brianteeman
Labels Added: Conflicting Files

Add a Comment

Login with GitHub to post a comment