Bug 153089 - AX: Nonfunctional controls appear before every HTML5 video when using VoiceOver
Summary: AX: Nonfunctional controls appear before every HTML5 video when using VoiceOver
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: Safari 9
Hardware: All All
: P2 Normal
Assignee: Aaron Chu
URL: http://ghbweb.com/ios_video_issue/
Keywords: InRadar
Depends on: 145684
Blocks: 157692
  Show dependency treegraph
 
Reported: 2016-01-13 18:13 PST by James Craig
Modified: 2016-05-13 16:38 PDT (History)
2 users (show)

See Also:


Attachments
Patch (9.29 KB, patch)
2016-04-22 11:28 PDT, Aaron Chu
no flags Details | Formatted Diff | Diff
Patch (9.59 KB, patch)
2016-04-25 18:02 PDT, Aaron Chu
no flags Details | Formatted Diff | Diff
Patch (13.51 KB, patch)
2016-04-28 00:22 PDT, Aaron Chu
no flags Details | Formatted Diff | Diff
Patch (13.81 KB, patch)
2016-05-04 16:04 PDT, Aaron Chu
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Craig 2016-01-13 18:13:50 PST
1/4/16, 5:37 PM Gordon Byrnes:
Summary:
When accessing HTML5 video on web pages using VoiceOver and Safari, two elements are added before every video. One is called "Show controls", and the other "start playback." The "show controls" element seems to be nonfunctional in all cases - clicking it has no effect. The "start playback" button generally works on simple HTML5 <video> tags, but not more complicated player interfaces. For instance, on the ubiquitous YouTube iframe embed, the "start playback" button does nothing at all unless the video has already been played by clicking the iframe, which can only be accessed by first navigating PAST both "show controls" and "start playback." This behavior is highly confusing.

Steps to Reproduce:
1. Turn on VoiceOver.
2. Visit a page containing simple HTML5 video elements and YouTube embedded iframes. See attached example or live version at http://ghbweb.com/ios_video_issue/.
3. Using VO + left/right arrow, navigate to the first video element.

Expected Results:
On navigating to element, the user should be able to interact with the appropriate player controls.

Actual Results:
Simple HTML <video> embeds:

- "start playback" button works largely as expected, but "show controls" button is nonfunctional.

YouTube iframes:

- Both "start playback" and "show controls" are entirely nonfunctional.

Version:
iOS 9.2 (13C75)

Notes:
According to comments within the script that actually generates the buttons, these two special controls were originally added as a workaround for this webkit bug 145684

Configuration:
- iPhone 6s / iPhone 5s, Safari, VoiceOver
Comment 1 James Craig 2016-01-13 18:15:14 PST
<rdar://problem/24050668>
Comment 2 James Craig 2016-01-13 18:27:39 PST
This is a regression since the fix in bug 145684 because the bogus "show controls" element is showing in the original HTML 5 video example, too:

http://www.w3.org/2010/05/video/mediaevents.html
Comment 3 James Craig 2016-01-13 18:54:32 PST
Show controls button should only be appearing in the shadow DOM when the controls toolbar is hidden (during playback) but it's accessible at all times.
<button pseudo="-webkit-media-show-controls" aria-label="Show Controls"></button>

This appears to partially work on OS X (after initial play "show controls" is only shown when controls are not), but it is not hiding on iPad, and should never be displayed on iPhone (iPhone always uses native playback controls, not shadow DOM controls).
Comment 4 James Craig 2016-01-13 19:20:59 PST
Possible regression candidate is bug 148755 due to the change re: showControlsButton hidden property. The shadow DOM element no longer has the 'hidden' DOM property (and subsequent content attr) set correctly.
Comment 5 James Craig 2016-01-13 19:25:51 PST
Scratch that last comment. It's unlikely that r189358 from bug 148755 made it into iOS 9.2 (13C75).
Comment 6 Aaron Chu 2016-04-22 11:28:13 PDT
Created attachment 277080 [details]
Patch
Comment 7 James Craig 2016-04-22 15:30:08 PDT
Comment on attachment 277080 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=277080&action=review

> Source/WebCore/Modules/mediacontrols/mediaControlsApple.js:16
> +    this.hasStartedPlaying = false;

See note below about isPlaying vs hasStartedPlaying.

> Source/WebCore/Modules/mediacontrols/mediaControlsApple.js:-672
> -

Avoid unnecessary whitespace-only changes.

> Source/WebCore/Modules/mediacontrols/mediaControlsApple.js:998
> +        } else {
>              this.video.pause();
> +        }

webkit-style: You need the closing brace from the if block, but the else block is a single line without braces. (not my pref, but webkit style guidelines)

> Source/WebCore/Modules/mediacontrols/mediaControlsApple.js:1555
> +        this.showShowControlsButton(this.isPlayable() && this.isPlaying && this.hasStartedPlaying);

Not clear what the difference between isPlaying and hasStartedPlaying is... Do you need both? And if so, pick a better name that more clearly indicates the difference.

> Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js:156
> +        if (this.controls.startPlaybackButton.parentNode) {
>              this.controls.startPlaybackButton.parentNode.removeChild(this.controls.startPlaybackButton);
> +        } 

webkit-style: excess braces for single line.

> LayoutTests/media/video-controls-show-on-kb-or-ax-event.html:17
> +    
> +
> +

Minor nit: remove the extra whitespace-only diffs.

> LayoutTests/media/video-controls-show-on-kb-or-ax-event.html:34
> +       
> +

Minor nit: remove the extra whitespace-only diffs.

> LayoutTests/media/video-controls-show-on-kb-or-ax-event.html:37
> +            //making sure we are getting the updated root.

webkit-style: Comments need to start with a capital (and end with a period like you have.)
Minor nit: "making" => "Make"

// Make sure we are getting the updated root.
Comment 8 Aaron Chu 2016-04-25 18:02:28 PDT
Created attachment 277299 [details]
Patch
Comment 9 Darin Adler 2016-04-26 09:21:20 PDT
Comment on attachment 277299 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=277299&action=review

I’m not giving a review+ or a review-, but I do have some comments:

I don’t think the tests cover enough cases. There are a couple interesting rules for when you are allowed to show controls and when you are not and I don’t see any test coverage for those rules.

> Source/WebCore/Modules/mediacontrols/mediaControlsApple.js:996
> +        } else 

Please don’t add trailing whitespace here.

> Source/WebCore/Modules/mediacontrols/mediaControlsApple.js:1526
> +        if (shouldShow) 
> +            this.showControlsButton.focus();

I’d think we’d only want to call focus() when we transition from hidden to not hidden, not when we call show but the controls happen to already be visible. Or maybe this function is only called when it’s changing the state?

> Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js:154
> -        if (this.controls.startPlaybackButton.parentNode)
> +        if (this.controls.startPlaybackButton.parentNode) 

Please don’t check in this addition of trailing whitespace.
Comment 10 Aaron Chu 2016-04-26 17:39:12 PDT
Comment on attachment 277299 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=277299&action=review

I will get the rest of the changes in.

>> Source/WebCore/Modules/mediacontrols/mediaControlsApple.js:1526
>> +            this.showControlsButton.focus();
> 
> I’d think we’d only want to call focus() when we transition from hidden to not hidden, not when we call show but the controls happen to already be visible. Or maybe this function is only called when it’s changing the state?

This only changes when the state is changed.
Comment 11 Aaron Chu 2016-04-28 00:22:42 PDT
Created attachment 277599 [details]
Patch
Comment 12 Aaron Chu 2016-04-28 00:27:06 PDT
Comment on attachment 277599 [details]
Patch

I extended the test to not only test on "mouseout" while the video is playing. I also added a test for the pause state and the initial state. I could also test the natural progression of the UI behavior, but I decided against it because, by default, the toolbar disappears completely at the 5th second after the video is played, which means that testing that natural behavior would require this test to last for >5 seconds. At the moment, this test should only take ~ 1 second.
Comment 13 James Craig 2016-05-02 21:00:33 PDT
Comment on attachment 277599 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=277599&action=review

Patch looks okay to me. Request final review from Dean Jackson or one of the other domain owners.

> LayoutTests/media/video-controls-show-on-kb-or-ax-event.html:64
> +                result.innerHTML += 'FAIL: "Show Controls" button are hidden or unavailable.<br>';

Minor typo: "are" -> "is" (Just in case there is more feedback. No need to re-spin for this alone… Unless it would eat at you later. ;-)
Comment 14 chris fleizach 2016-05-02 23:57:29 PDT
Comment on attachment 277599 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=277599&action=review

> Source/WebCore/ChangeLog:3
> +        Fix to make sure the showControls button in a media player behaves correctly.

this should be the title of the bug

you can use ./Tools/Scripts/prepare-Changelog --bug=277599 to help with this

> LayoutTests/ChangeLog:3
> +        A Layout Test to make sure showControls Button in media player is hidden by default.

ditto

> LayoutTests/media/video-controls-show-on-kb-or-ax-event.html:21
> +        result.innerHTML = "";

incorrect indentation
Comment 15 Dean Jackson 2016-05-04 11:46:45 PDT
Comment on attachment 277599 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=277599&action=review

Looks good with the notes Chris already made.

> LayoutTests/media/video-controls-show-on-kb-or-ax-event.html:79
> +            }, 300);
> +        }, 400);

It's a shame this test now takes more than a second to run :(
Comment 16 Aaron Chu 2016-05-04 16:04:24 PDT
Created attachment 278138 [details]
Patch
Comment 17 WebKit Commit Bot 2016-05-04 17:05:09 PDT
Comment on attachment 278138 [details]
Patch

Clearing flags on attachment: 278138

Committed r200441: <http://trac.webkit.org/changeset/200441>
Comment 18 WebKit Commit Bot 2016-05-04 17:05:13 PDT
All reviewed patches have been landed.  Closing bug.