? Pending

User tests: Successful: Unsuccessful:

avatar wilsonge
wilsonge
16 Sep 2018

This reworks the way we hack chosen to pieces. This is done by creating a Joomla instance that extends the chosen instance to place most our hacks in. it should be added that this still requires a hack (we have to expose chosen and it's base class that isn't done by default - which i'm just regex'ing in as part of the build script. However this means we can now use the npm distributed packages without having to be as careful to ensure all our hacks are propagated (note we are now more dependent on chosen internals however so care must still be taken) - as far as I could tell we could only do this if we wrote our own coffeescript to extend the chosen classes and compiled that which is not something I feel comfortable doing.

Documentation

We're now fully on the stable version of chosen 1.6.1 - the 1.0 migration involved changes in class names and js events - we should note people must refer to these docs

Something to do with the fact that to emulate the j3.x code when creating custom chosen implementations you need to use jchosen function in jquery rather than chosen

Other Notes

My apologies to the JS community for this abomination.

avatar wilsonge wilsonge - open - 16 Sep 2018
avatar wilsonge wilsonge - change - 16 Sep 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 16 Sep 2018
Category Administration com_categories com_config com_modules Templates (admin) Repository JavaScript Front End Libraries
avatar brianteeman
brianteeman - comment - 16 Sep 2018

Can't we just drop it as it's horrendous for a11y?

avatar wilsonge
wilsonge - comment - 16 Sep 2018

If you can come up with and implement a concrete alternative for sure for the places we’re using it (category, module positions and tags afaik). But Dimitris spent 2 years trying to find something like that and couldn’t make it work. So I’m doubtful it’s possible at this point.

avatar brianteeman
brianteeman - comment - 16 Sep 2018

can you define the exact requirements. otherwise all the work improving a11y is pretty much wasted

avatar wilsonge
wilsonge - comment - 16 Sep 2018

Sure so we can split tags and the module/positions categories into two if it helps - because they are largely separate visual elements

Categories/Module Positions

  • Ability to have groups of items and filter either by item name or by group name to show all items (the group filtering is our addition to chosen)
  • Ability to ajax submit new items (this is currently the ajax-chosen.js) stuff (new module position/categories)
  • Possible choices might work for this part (if it meets ally) #15916 (i think this part was ready - but choices wasn't working out for tags)
  • Placeholder support
  • RTL support
  • A11y

Tags

  • Multiselect
  • Ability to dynamically find results by an ajax request
  • Add new items (there's a value added to new items to show them as new iirc - I believe this was the issue dimitris had with choices jshjohnson/Choices#163)
  • Placeholder support
  • RTL support
  • A11y
  • Javascript events thrown to hook into

If we can find a jquery free solution that would be massive bonus points but not 100% essential

avatar wilsonge
wilsonge - comment - 16 Sep 2018

You also know the functionality we have in tags/categories/modules so if you think I'm missing anything here do say - it's been a long time since i touched this part of the codebase

avatar wilsonge
wilsonge - comment - 16 Sep 2018

Even if Brian is searching for replacements I'd still like tests on this btw. It doesn't block us finding an alternative. It's just making maintenance easier until we find something else

avatar brianteeman
brianteeman - comment - 16 Sep 2018

Choices really does look the best option to me - didn't spot the reference to it in your post when I was searching. Not sure I really understand the part that you say there is an issue with

avatar wilsonge
wilsonge - comment - 17 Sep 2018

So as far as I can tell from a first pass yesterday choices only supports adding extra options to text fields - not select fields :( but gonna take a more detailed pass today and see what I can come up with

avatar Fedik
Fedik - comment - 17 Sep 2018

choices only supports adding extra options to text fields - not select fields

that should be no problem, any input is input ?
just need to investigate how can handle it with an existing data model, how to adopt

maybe I also try to check, when will get some free time,
I do not very like to have Choosen in j4

avatar wilsonge
wilsonge - comment - 17 Sep 2018

I have no problem with anyone researching/working on alternatives. I'm as much down for it as you all are! But for two years now people have said this. And if we can't find anything we need chosen to have styling and be more maintainable than it is in 3. This doesn't block the work any of us do in finding a replacement

avatar Fedik
Fedik - comment - 17 Sep 2018

something still wrong with the hack,
I tried to test to add a new module position, and new tag in article, but not work

upd: custom module position does not work even without this patch

avatar dgrammatiko
dgrammatiko - comment - 17 Sep 2018

@wilsonge unless you fix jshjohnson/Choices#163 choices is not suitable for this project. Also you have to redo the AJAX part for the tags and some interesting implementation for the categories.
The idea of having all the fields as custom elements was a way to get away from the event driven architecture (although that's half true as the events are just left for the browser to handle).
BUT the event driven architecture fits the bill for Joomla, unfortunately the front end in this project can not keep up with the next age state driven (actually its the current era, eg: VUE, REACT etc)

Finally you might find https://codepen.io/dgrammatiko/pen/bvOdZp useful

My 2c, since you mentioned me

avatar wilsonge wilsonge - change - 18 Sep 2018
Labels Added: ?
avatar wilsonge
wilsonge - comment - 18 Sep 2018

Fixed tags (somewhere I missed committing some files doing the class updates) and added the missing class that had stopped module positions working

avatar Fedik
Fedik - comment - 18 Sep 2018

I have tested this item successfully on ff864f2

now it working :)


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

avatar Fedik Fedik - test_item - 18 Sep 2018 - Tested successfully
avatar laoneo
laoneo - comment - 19 Sep 2018

@brianteeman all ok here from a11y point of view?

avatar wilsonge
wilsonge - comment - 19 Sep 2018

Expectation is that it's not "OK" but it's not going to be worse either as we're not changing any of the HTML output

avatar laoneo
laoneo - comment - 19 Sep 2018

Ok, so lets get it merged.

avatar laoneo laoneo - change - 19 Sep 2018
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-09-19 09:21:05
Closed_By laoneo
avatar laoneo laoneo - close - 19 Sep 2018
avatar laoneo laoneo - merge - 19 Sep 2018
avatar wilsonge
wilsonge - comment - 19 Sep 2018

Thanks :)

avatar Fedik
Fedik - comment - 19 Sep 2018

choices only supports adding extra options to text fields - not select fields

@wilsonge unless you fix jshjohnson/Choices#163 choices is not suitable for this project

@wilsonge @dgrammatiko "I believe it can fly" :neckbeard:
check #22263

avatar frogydiak
frogydiak - comment - 22 Oct 2018

@wilsonge and @dgrammatiko, are you both talking of the same javascript Choices? LOL! I've been following links and reading the conversation from several posts related to changing chosen to choice-js and I am confused if @wilsonge is talking about Choices which is @dgrammatiko is talking about.

Choice and Choices, LOL! which one?

Also, I can't seem to find what @wilsonge.. I mean @Fedik is working merged into the daily update. Chosen is still the script being loaded.

avatar wilsonge
wilsonge - comment - 23 Oct 2018

We are both talking about that one yes :)

avatar frogydiak
frogydiak - comment - 23 Oct 2018

@wilsonge Awesome! Can't wait for it be merged into the nightly build. Quick question, is it possible for Choices to have two elements that are related to each other? Something like, two elements have the same options but when an option is selected in either one, that option is no longer available in the other?

avatar laoneo
laoneo - comment - 24 Oct 2018

It got merged over a month ago and is part of alpha5 and any nightly since then.

avatar frogydiak
frogydiak - comment - 24 Oct 2018

@laoneo Hmmm... I can't find choices.js being loaded except for chosen.jquery.js and no where in media/vendor. I am updating everyday from nightly build (broken by the way since metismenujs was added, 3-4 days ago).

Here's my header screen cap.

j4_chosen

avatar mbabker
mbabker - comment - 24 Oct 2018

This PR was merged already. The one removing Chosen and adding Choices (#22263) is still open.

avatar frogydiak
frogydiak - comment - 24 Oct 2018

Confirmed, as of Wednesday, 24 October 2018 02:00:35 UTC nightly build, Joomla update is now working.

Got it! That's why I can't find choices.js anywhere. Thanks!

Add a Comment

Login with GitHub to post a comment