User tests: Successful: Unsuccessful:
Pull Request for Issue #23448 and #23402 (comment)
Update choices.js and fix issue caused by moving the element in DOM tree.
Before testing, run npm install
Please read #23448
@Hackwar please test it, it should fix your issue also.
none
side note: @dgrammatiko I would suggest to review joomla-tab.js
behavior, it should not move content around on resize. It mess up DOM tree, and will cause many more bugs in future.
Status | New | ⇒ | Pending |
Category | ⇒ | Repository JavaScript |
There is no rule that prohibits anyone to move nodes around the tree...
There one golden rule: "Do not mess the DOM"
Actually this behaviour reveals our bad implementation of custom elements...
It not only about CE. Joomla! forms are heavy already (can have 100+ inputs), moving nodes just force a browser re-evaluate everything. Additionally Developers can have a custom scripts (even more fancy than CE), that no one know how they will behavior if you change DOM in way tabs.js doing.
Instead of moving content, the tabs.js
can just move the "navigation buttons", or even render them twice and switch by media query in CSS, that even more flexible. Also, example when you have just a 2 tab, you do not need to switch them to accordion. It should not be forced and hardcoded to 920px.
You should be able to create the element without ...
A <select>
already required, you just will get an error about. So I do not see a problem.
This is correct use:
x = document.createElement('joomla-field-fancy-select');
x.innerHTML = '<select><option value="zzzz" selected>oooo</option>';
document.body.appendChild(x);
It can be change later on demand, when someone really really need it.
The choices.js should be integral part of the custom element code...
Injecting choicies.js (or any othe blablba.js) in to CE also wrong
Injecting choicies.js (or any othe blablba.js) in to CE also wrong
It's the second best choice since we cannot use imports which is the right way.
This is correct use:
x = document.createElement('joomla-field-fancy-select');
x.innerHTML = '<select><option value="zzzz" selected>oooo</option>';
document.body.appendChild(x);
I'm afraid that the DOM can also work the other way around (create an empty element and inject the contents later on). You can force people to do it your way but you're not complying with the specs...
It should not be forced and hardcoded to 920px
Tabs shouldn't really change to accordion, that was a suggestion from the a11y group that I rushed to code. Anyways tabs already have been rewritten without this part, once the rest of the custom elements in this repo have been corrected I'll pull that code in
Labels |
Added:
?
|
It's the second best choice since we cannot use imports
I have changed, will be safe now, without injecting and without "while" loops
not complying with the specs...
I am who do the specs here
So it require <select>
to be preset. And any direct manipulation of CE children not allowed.
It like a single CE with shadow DOM, but without shadow DOM
And any direct manipulation of CE children not allowed.
Not really, check this:
Setting up a mutation observer:
joomla-cms/build/media/webcomponents/js/editor-none/editor-none.js
Lines 18 to 21 in e887207
textarea
)joomla-cms/build/media/webcomponents/js/editor-none/editor-none.js
Lines 98 to 111 in e887207
But anyways this is good enough for the time, let's patch the rest as well...
@dgrammatiko but you know the cost of MutationObserver ?
Especially when choices.js (or other script that used with CE, eg editors scripts etc) doing a changes itself.
From my point of view it doesn't worth to bother about it
this is broken now, need full redo
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-02-22 11:53:02 |
Closed_By | ⇒ | Fedik |
Category | Repository JavaScript | ⇒ | Repository JavaScript NPM Change |
That code is really bad, I know! But Is exposing all the wrong things that we did in the custom elements, so don't expect an update before all the custom elements are correctly implemented.
There is no rule that prohibits anyone to move nodes around the tree. Actually this behaviour reveals our bad implementation of custom elements... On the practical side, I guess the idea to transform tabs to accordion should be dropped for the production code, although it's a great accessibility win, for the reasons you also mention: future bugs (eg devs bad scripts)
This PR is taking this component one step close to production but there are 2 more things that needs to be patched here: