Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#35257 closed defect (bug) (fixed)

Update button not completely disabled after plugin update on plugin-install.php screen

Reported by: adamsilverstein's profile adamsilverstein Owned by: ocean90's profile ocean90
Milestone: 4.5 Priority: normal
Severity: normal Version: 4.3
Component: Upgrade/Install Keywords: has-patch commit
Focuses: accessibility, javascript Cc:

Description (last modified by adamsilverstein)

Updating a plugin on the plugin-install.php screen uses an ajax process to update plugins in-line. When a plugin upgrade succeeds, the button is updated accordingly; however the click handler for the button is still in place, and clicking the button again results in some unexpected behavior - the upgrade request fires again and fails, and the complete checkmark spins around:

http://cl.ly/052o2E2H3O44/Screen%20Recording%202015-12-29%20at%2001.30%20PM.gif

To fix this, we should prevent the action for disabled buttons, patch incoming.

Attachments (2)

35257.diff (535 bytes) - added by adamsilverstein 8 years ago.
35257.2.diff (1.7 KB) - added by afercia 8 years ago.

Download all attachments as: .zip

Change History (10)

#1 @adamsilverstein
8 years ago

  • Description modified (diff)

#2 @swissspidy
8 years ago

  • Keywords has-patch needs-testing added

#3 follow-up: @adamsilverstein
8 years ago

  • Keywords has-patch needs-testing removed

Worth noting here that if these were actually buttons we could disable them instead of adding a disabled style and looking for that in our click handler... instead these 'buttons' are a href links styled to look like buttons. Does anyone have insight into why the buttons are constructed this way?

#4 @swissspidy
8 years ago

  • Focuses accessibility added

#5 in reply to: ↑ 3 @afercia
8 years ago

Replying to adamsilverstein:

Does anyone have insight into why the buttons are constructed this way?

I think that's because when JS is off, these links behave like regular links and the update will take place on /wp-admin/update.php. Instead, when JS is on, they behave like buttons (they "do" something), so they should have a semantics of button and recently a aria-button-if-js CSS class was introduced in [35947]. I'd suggest to use it.
About the main issue, maybe just return on click if the link has the class updated-message?

@afercia
8 years ago

#6 follow-up: @afercia
8 years ago

Just realized the button should do nothing also while the update is in progress. Clicking multiple times while updating can lead to simiilar inconsistent button states :) Adding the aria-button-if-js class would make the link be announced as "button" by screen readers, see the screenshot below:

https://cldup.com/Zwiz8O-sha.png

When navigating away from the button and then back, screen readers will still say "button" and that the plugin is updated. Not ideal but maybe acceptable since the button will do nothing.

While this would be an improvement, I think shiny updates should have a better structured error handling mechanism. For example, what users are supposed to do when an update fails? There's no chance to "retry". The only way to interact again with the UI is to refresh the page, unless I'm missing something.

#7 in reply to: ↑ 6 @adamsilverstein
8 years ago

  • Keywords has-patch commit added
  • Milestone changed from Awaiting Review to 4.5

While this would be an improvement, I think shiny updates should have a better structured error handling mechanism. For example, what users are supposed to do when an update fails? There's no chance to "retry". The only way to interact again with the UI is to refresh the page, unless I'm missing something.

We are working on these issues in the shiny updates feature plugin; for now this ticket was opened to solve the very narrow issue of the update buttons not being disabled - as you point out while - and after the action is initiated.

Latest patch looks good!

#8 @ocean90
8 years ago

  • Owner set to ocean90
  • Resolution set to fixed
  • Status changed from new to closed

In 36558:

Updates: Prevent further actions if an update button is disabled.

Props adamsilverstein, afercia.
Fixes #35257.

Note: See TracTickets for help on using tickets.