? ? Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
27 Dec 2017

Summary of Changes

Convert subform.js to custom element <joomla-field-subform />

Testing Instructions

Add subform field in to an any form, and check whether it works as usual.

Documentation Changes Required

yes I think

Todo:

  • make sorting to work (important)
  • nested forms (optional)

@dgt41 Christmas present to you ?

avatar Fedik Fedik - open - 27 Dec 2017
avatar Fedik Fedik - change - 27 Dec 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 27 Dec 2017
Category Layout JavaScript
avatar Fedik Fedik - change - 27 Dec 2017
The description was changed
avatar Fedik Fedik - edited - 27 Dec 2017
avatar Fedik Fedik - change - 27 Dec 2017
The description was changed
avatar Fedik Fedik - edited - 27 Dec 2017
avatar Fedik Fedik - change - 27 Dec 2017
Labels Added: ?
avatar Fedik Fedik - change - 27 Dec 2017
The description was changed
avatar Fedik Fedik - edited - 27 Dec 2017
avatar dgt41
dgt41 - comment - 27 Dec 2017

Great work @Fedik Merry Christmas to you too!! ?

avatar dgt41
dgt41 - comment - 27 Dec 2017

@Fedik check Fedik#4

avatar dgt41
dgt41 - comment - 27 Dec 2017

Another thing about the sortable functionality: it needs to be keyboard accessible. I have no clue if either the draggula or the airbnb script are accessible! Anyways some time ago @brianteeman pointed out some resource about accessible drag and drop: https://www.sitepoint.com/accessible-drag-drop/
(I think it's the correct one, but I couldn't find the actual discussion).
All and all we need to re-evaluate the script for drag and drop considering accessibility!

avatar joomla-cms-bot joomla-cms-bot - change - 28 Dec 2017
Category Layout JavaScript JavaScript Repository Layout
avatar Fedik
Fedik - comment - 29 Dec 2017

@dgt41 current problem is to make the sorting to work, at least ?

because it is now a custom element, I do not think it will be good idea to have "external dependency"

as you already told, can be need to merge in to single file

avatar Fedik
Fedik - comment - 2 Jan 2018

@dgt41 and idea,
what if we drop "drag sorting" and just make "old school" a two arrows 'move Up'/'move Down' ?
it is perfect for accessibility and should not be hard to implement :neckbeard:

avatar dgt41
dgt41 - comment - 2 Jan 2018

@Fedik let's create couple codepens with deferent approaches and let the a11y and design team decide which way the want to go. For me anything that fulfils the requirements is good enough! ?

avatar C-Lodder
C-Lodder - comment - 2 Jan 2018

@Fedik would be easy to implement but we'd be going backwards rather than forwards. J3 supports drag-n-drop and J4 only allows you to move rows 1 place at a time

avatar dgt41
dgt41 - comment - 2 Jan 2018

@C-Lodder J3's drag and drop is not accessible, the point is accessibility here, if we can replicate J3 dnd in accessible fashion lets do it, else let's do something that is accessible...

avatar C-Lodder
C-Lodder - comment - 2 Jan 2018

Brian shared a link for an a11y dnd a while back. It's definitely possible

avatar Fedik
Fedik - comment - 2 Jan 2018

but we'd be going backwards rather than forwards

it an evolution loop ?
well, just an idea ?

for now I do not have any solution

Brian shared a link for an a11y dnd a while back. It's definitely possible

the problem with that example, that it use HTML5 draggable which do not work good on mobiles

avatar brianteeman
brianteeman - comment - 2 Jan 2018

up - down arrows are not an improvement and they are not better for accessibility

It is perfectly possible to provide keyboard support for drag and drop
See https://www.sitepoint.com/accessible-drag-drop/ for info
http://jspro.brothercake.com/multidrag/demo4b.html for demo

avatar dgt41
dgt41 - comment - 2 Jan 2018

@Fedik do you want to experiment on the code of site point that @brianteeman posted above?
I could spend some time to make this behave as the sortable

avatar Fedik
Fedik - comment - 2 Jan 2018

@dgt41 I will try on next weekend,
but any help are welcome ?

avatar dgt41
dgt41 - comment - 4 Jan 2018

@Fedik check

I can live with a CE wrapper (joomla-sortable) for this lib ;)

avatar Fedik
Fedik - comment - 4 Jan 2018

@dgt41 I seen that, but somehow I do not liked that ?

If use of external lib, then I would stop on https://github.com/Shopify/draggable they declare Accessibility support https://github.com/Shopify/draggable/search?q=accessibility&type=Issues&utf8=%E2%9C%93

for now I try native HTML 5 dragable API, with some polyfill for mobile browsers

avatar Fedik
Fedik - comment - 4 Jan 2018

note for me

keymap:

tab to switch element / switch drop target
space (or modifier + space) to select
ctrl+m / enter to place
esc to cancel

avatar Fedik
Fedik - comment - 6 Jan 2018

for now,
Desktop drag sorting, works.

Keyboard sorting, works:

  1. tab to navigate to needed row,
  2. (ctr,alt,shift) + space select the row,
  3. tab to select destination,
  4. enter to place selected row in to destination

esc to cancel selection

avatar dgt41
dgt41 - comment - 6 Jan 2018

Great! One thing though the source in in build/webcomponents/... not directly in the media/system/webcomponents. The later is the compiled/transpiled version

avatar Fedik
Fedik - comment - 6 Jan 2018

I still need to add keyboard navigation to add/remove buttons.
Test the mobile dragable polyfil.
And try something with "nested" forms, if I will have a mood ?

avatar joomla-cms-bot joomla-cms-bot - change - 8 Jan 2018
Category Layout JavaScript Repository Administration Templates (admin) JavaScript Repository Layout
avatar Fedik Fedik - change - 8 Jan 2018
The description was changed
avatar Fedik Fedik - edited - 8 Jan 2018
avatar Fedik
Fedik - comment - 8 Jan 2018

@dgt41 can you please have a look, I cannot make es6 minyfied, there some random error ?
screen 2018-01-08 15 48 15 751x206

avatar dgt41
dgt41 - comment - 8 Jan 2018

@Fedik run

npm install git://github.com/gruntjs/grunt-contrib-uglify.git#harmony --save-dev

and change in the Gruntfile.js the line

grunt.loadNpmTasks('grunt-contrib-uglify');

to

grunt.loadNpmTasks('grunt-contrib-uglify-es');

then run again grunt createElement

avatar Fedik
Fedik - comment - 10 Jan 2018

@dgt41 works. thanks!

avatar joomla-cms-bot joomla-cms-bot - change - 13 Jan 2018
Category Layout JavaScript Repository Administration Templates (admin) Administration Templates (admin) JavaScript Repository Layout Libraries
avatar Fedik
Fedik - comment - 13 Jan 2018

Now it support a base nesting, however I would not recommend to use a complex nested forms, and complex fields in a nested forms. example an editor field should not be in nested.

avatar Fedik Fedik - change - 13 Jan 2018
The description was changed
avatar Fedik Fedik - edited - 13 Jan 2018
avatar Fedik Fedik - change - 13 Jan 2018
Title
[4.0][WIP] Subform custom element
[4.0] Subform custom element
avatar Fedik Fedik - edited - 13 Jan 2018
avatar Fedik
Fedik - comment - 13 Jan 2018

This is ready for testing.

Use any existing subform field, and make sure it still work.
Or use this example:

<field name="field-name" type="subform" multiple="true" label="Subform Field">
	<form>
		<field type="text" name="text" label="text" />
	</form>
</field>

For nested:

<field name="field-name-other" type="subform" multiple="true" label="Subform Field">
    <form>
        <field type="text" name="text" label="text" />
        <field name="subform-nested" type="subform" multiple="true" label="Nested Field"
            layout="joomla.form.field.subform.repeatable-table">
            <form>
                <field type="text" name="text-nested" label="text2" />
            </form>
        </field>
    </form>
</field>
avatar brianteeman
brianteeman - comment - 18 Jan 2018

@Fedik if you can resolve the conflicts I will give it a try

avatar Fedik
Fedik - comment - 18 Jan 2018
avatar brianteeman
brianteeman - comment - 18 Jan 2018

Thanks will test tomorrow

avatar brianteeman
brianteeman - comment - 19 Jan 2018

Tested with a subform and cannot work out how to get the sorting by keyboard to work

avatar Fedik
Fedik - comment - 20 Jan 2018

Tested with a subform and cannot work out how to get the sorting by keyboard to work

@brianteeman I knew it will be hard, and it is really hard :neckbeard:

Once again for Keyboard sorting:

  1. tab to navigate to needed row,
  2. (ctr,meta,shift) + space select the row,
  3. tab to select a destination,
  4. enter to place selected row in to destination

The sorting by keyboard in pictures

I have painted a couple pictures.

  1. tab to navigate to needed row (I would recommend to click the label first, to get there faster), you should see "row in focus" (style different from OS & Browser):
    screen 2018-01-20 17 26 05 871x417

  2. ctrl + space OR shift + space OR meta + space to select the row (aria-grabbed="true"), you should notice darkblue shadow:
    screen 2018-01-20 17 26 18 871x417

  3. now use tab to focus the destination, where selected row should be placed:
    screen 2018-01-20 17 26 40 871x417

  4. push enter, now the selected row should be placed at destination:
    screen 2018-01-20 17 27 01 871x417

  5. Done!

But it is really hard, especial if you have a lot of fields inside, you should push tab 1000 times.
I tried to follow a recommendations from https://www.sitepoint.com/accessible-drag-drop/ and some other sources.

Any suggestions to improve are welcome ?

avatar brianteeman
brianteeman - comment - 20 Jan 2018

Thanks for the update. I will try again soon. I was definitely trying to do what you showed in the images.

avatar Fedik
Fedik - comment - 20 Jan 2018

I was definitely trying to do what you showed in the images.

Also there was problem with minimized template.min.css, and "select' action was invisible.
Maybe this was a reason.
I have updated template.min.css in last commit

avatar brianteeman
brianteeman - comment - 20 Jan 2018

ok it works now. ;)

One question.
After selecting a row I would expect the next tab would take me to the next row where I want to place the selected row. However i have to tab through all the elements in the row to get to the next row

avatar Fedik
Fedik - comment - 20 Jan 2018

After selecting a row I would expect the next tab would take me to the next row where I want to place the selected row. However i have to tab through all the elements in the row to get to the next row

I would expect it also.

The problem that the rows use tabindex="0" and so "flow" with other elements/input on the page.
I tried to set it tabindex="1" then it works a bit better, however I have read recommendation to do not use tabindex bigger than zero, because it can confuse screen-reader, or something.

So for now it like this.
Maybe in future we will get a better idea how to fix it.

avatar dgt41
dgt41 - comment - 6 Feb 2018

@wilsonge can you please merge this one?
@Fedik please fix the conflict

avatar Fedik
Fedik - comment - 6 Feb 2018

done

avatar frogydiak
frogydiak - comment - 6 Feb 2018

How did you guys tested this subform field? The ability to move cloned fields is not working in my test. Someone told me in my other post that jqueryUI has been deprecated in J!4 but I'm getting error with it in the subform field. Here's the screen capture:

http://take.ms/eNrxb

avatar mbabker
mbabker - comment - 6 Feb 2018

Someone told me in my other post that jqueryUI has been deprecated in J!4 but I'm getting error with it in the subform field

Not all deprecated items have been removed yet. If it's marked deprecated in 3.x and still exists today in the 4.0 code, that doesn't necessarily mean it's going to survive to the stable release. Remember 4.0 is very much still a work in progress.

avatar dgt41
dgt41 - comment - 6 Feb 2018

@frogydiak well jquery-ui is not used in this PR.
Go to issues.joomla.org and click on the link Fedik:subform-custom-element then install Joomla...
screen shot 2018-02-06 at 21 11 45

avatar frogydiak
frogydiak - comment - 6 Feb 2018

@mbabker Thanks for the explanation, I'm quite new to github joomla and wanted to participate on reporting issues. I am confused to say the least. LOL! If you look at dgt41 saying above, he's pointing me to another website that is loading this thread. What?! Do I have to know in-depth Joomla developer jargons to be able to help out? Why do you guys decided to have another site for issue tracker when you can just redirect to github? Another layer of confusion and system to develop and manage. There's no clear guidelines as what to expect in J!4 branch. That explanation you did could have been in the README.md but it seems to me it was just copied from previous versions. scratching my head... confused!

avatar joomla-cms-bot joomla-cms-bot - change - 3 Mar 2018
Category Layout JavaScript Repository Administration Templates (admin) Libraries Administration Templates (admin) JavaScript Repository Unit Tests Layout Libraries
avatar Fedik Fedik - change - 3 Mar 2018
Labels Added: ?
avatar dgrammatiko
dgrammatiko - comment - 9 Apr 2018

@Fedik can you resolve the conflict here?

avatar Fedik
Fedik - comment - 9 Apr 2018

done

avatar dgrammatiko
dgrammatiko - comment - 9 Apr 2018

@Fedik can you merge: Fedik#7 and Fedik#6

Then I can mark my test as successful here

avatar Fedik
Fedik - comment - 9 Apr 2018

@dgrammatiko done, thanks!

avatar dgrammatiko
dgrammatiko - comment - 9 Apr 2018

I have tested this item successfully on bdaf42d


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

avatar dgrammatiko dgrammatiko - test_item - 9 Apr 2018 - Tested successfully
avatar laoneo
laoneo - comment - 17 Apr 2018

As the tests got moved to a separate repo you need to create a pr with the tests in the JS testing repo and remove them from here.

avatar brianteeman
brianteeman - comment - 17 Apr 2018

@laoneo and thats why it was not the best decision

avatar dgrammatiko
dgrammatiko - comment - 17 Apr 2018

@laoneo since all tests are basically nullified we can safely remove them in this PR as well.
Of course at some later point (eg API is stable) we will spent some time redoing them, but right now I guess this is not a show stopper

avatar dgrammatiko
dgrammatiko - comment - 17 Apr 2018

and thats why it was not the best decision

so I will agree this is bad for the short term but once the tests are done correctly this would be a better solution. (the main advantage is that if a PR breaks some tests this will be very obvious and since we want to keep B/C tests should never break, at least that's part of the theory there)

avatar laoneo
laoneo - comment - 17 Apr 2018

@brianteeman I wasn't part of that decision and do not know all the pros and cons. For now, if the tests are unnecessary then lets remove them in this pr and add them later.

avatar dgrammatiko
dgrammatiko - comment - 17 Apr 2018

@Fedik can you resync this (basically you will have to delete the tests as these were deleted few days ago)

avatar joomla-cms-bot joomla-cms-bot - change - 17 Apr 2018
Category Layout JavaScript Repository Administration Templates (admin) Libraries Unit Tests Administration Templates (admin) JavaScript Repository Layout Libraries
avatar laoneo
laoneo - comment - 19 Apr 2018

@Fedik can this be tested by creating a new list custom field as it uses subforms?

avatar Fedik
Fedik - comment - 19 Apr 2018

@laoneo it should work as it was before, everywhere where subform field was used ?
so yes

avatar laoneo laoneo - change - 24 Apr 2018
Labels Removed: ?
avatar laoneo
laoneo - comment - 26 Apr 2018

I have tested this item successfully on bdaf42d


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

avatar laoneo laoneo - test_item - 26 Apr 2018 - Tested successfully
avatar dgrammatiko
dgrammatiko - comment - 26 Apr 2018

I have tested this item successfully on bdaf42d


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

avatar dgrammatiko dgrammatiko - test_item - 26 Apr 2018 - Tested successfully
avatar franz-wohlkoenig franz-wohlkoenig - change - 26 Apr 2018
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 26 Apr 2018

Ready to Commit after two successful tests.

avatar laoneo laoneo - change - 26 Apr 2018
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-04-26 06:27:20
Closed_By laoneo
Labels Added: ?
avatar laoneo laoneo - close - 26 Apr 2018
avatar laoneo laoneo - merge - 26 Apr 2018
avatar phalouvas
phalouvas - comment - 2 May 2018

Below problem occurred after this update. I tried to see where exactly is the problem, but failed. The test was on Microsoft Edge browser.
form_problem

avatar laoneo
laoneo - comment - 2 May 2018

Can you please open a new issue with the problem. Thanks for understanding.

Add a Comment

Login with GitHub to post a comment