[wp-trac] [WordPress Trac] #35429: Allow new plugins to be uploaded without having to go to a new page first.

WordPress Trac noreply at wordpress.org
Mon Feb 15 15:40:35 UTC 2016


#35429: Allow new plugins to be uploaded without having to go to a new page first.
-------------------------------------+-------------------------------------
 Reporter:  Ipstenu                  |       Owner:  michaelarestad
     Type:  enhancement              |      Status:  assigned
 Priority:  normal                   |   Milestone:  4.5
Component:  Plugins                  |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch has-           |     Focuses:  ui, accessibility,
  screenshots                        |  javascript
-------------------------------------+-------------------------------------

Comment (by afercia):

 Totally in favor of meaningful CSS class names and avoiding code
 repetition. By the way, these two buttons shouldn't be exactly the same :)
 for a simple reason. In the Plugins screen there's also a no-JavaScript
 fallback, i.e. the button is a real link that works also when JavaScript
 is off.

 In the Themes screen there's no fallback when JavaScript is off, that
 button is not a real link so `<a href="#"` should really be a `<button
 type="button"` (so, no button role added via JS). In this case there
 wouldn't be the need to prevent the button default action since there's no
 default action to prevent.

 While, theoretically, a `<button>` element would be better for semantics
 and accessibility, I'd be in favor of keeping the link (as long as it uses
 a role=button), sharing the JS, and move it in `common.js`. Then, in
 future iterations, this could also be abstracted a bit in order to work
 with any toggle/panel.

 About the JS part, in jQuery it is possible to write stuff in a sort of
 "chain" so basically once you have an element you can write something like
 this:
 {{{
 uploadBrowseButton.attr( ... ).on( ... );
 }}}
 which then for convenience and code readability can be indented this way:

 {{{
 uploadBrowseButton
         .attr(
                 ...
         )
         .on(
                 ...
         );
 }}}
 Not sure why this was changed in two separate blocks in the previous
 patches, it is also possible I'm definitely missing something :)

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35429#comment:26>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list