Tests for :focus and :focus-within

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Tests for :focus and :focus-within

Florian Rivoal-4
Hi Fantasai and Tab,

I'm about to start writing some tests fro :focus-within, as well as for the clarifications that were added to :focus while working on it (e.g. :focus does not apply to the parent of a focused element).

Since you'll be on the reviewing end of these tests, I wanted to check with you if my approach of choice was something you'd accept, or if I should switch gears. I've attached a sample, and I'll be writing a bunch more once you validate the approach.

I'm thinking to make them as semi-automated reftests. There's one element in the page that will need to be focused, and once it is, the thing is a regular ref test.

As for getting it focused, I am planning to:
- Say in the visible text that the thing must be focused
- include a tiny bit of js to focus it for you if you're running the test in a UA with JS.

Since the js bit is an optional convenience, not a required part of the test, I'm  not including the "dom" flag[1], and since a human may need to focus the control manually before the test can be evaluated, I include the "interact" flag.

In addition to the usual red and green, I'm using blue if the element that needs to be focused for the test to make sense isn't focused.

Also, for this to be work as ref test, I need to suppress UA specific things displayed when something is focused (focus outline, caret), since I cannot replicate them in the ref file.

Questions:
1 - Does it make sense to do it as a ref-test, or should I give up on the reference, and simply have it as a manual test? This would allow me to avoid suppressing focus indicators.

2 - If I stay on the ref test (or manual test) approach, should I keep the helper js?

3 - Do you agree on having "interactive" but not "dom" in the flags?

4 - Do you agree on that the use of the color blue to indicate "pay attention, this thing needs to be focused" is useful?

Cheers,
 - Florian
[1] http://testthewebforward.org/docs/css-metadata.html#requirement-flags


selectors-focus-001-ref.html (596 bytes) Download Attachment
selectors-focus-001.html (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Tests for :focus and :focus-within

fantasai
On 09/18/2015 05:37 AM, Florian Rivoal wrote:
> Hi Fantasai and Tab,
>
> Questions:
> 1 - Does it make sense to do it as a ref-test, or should I give up on the reference, and simply have it as a manual test? This would allow me to avoid suppressing focus indicators.
>
> 2 - If I stay on the ref test (or manual test) approach, should I keep the helper js?

Keep the helper JS. If we can run it automatically, that's very helpful
for regression testing.

Make sure you include class="reftest-wait" on the HTML element
and remove it once JS has verified that the element has been
focused (whether manually or via JS).

> 3 - Do you agree on having "interactive" but not "dom" in the flags?

Yes, I think that's reasonable.

> 4 - Do you agree on that the use of the color blue to indicate "pay attention, this thing needs to be focused" is useful?

I think that's fine, but since I can't see the test, I can't
comment further. :)

~fantasai

Reply | Threaded
Open this post in threaded view
|

Re: Tests for :focus and :focus-within

fantasai
On 09/18/2015 05:00 PM, fantasai wrote:
> On 09/18/2015 05:37 AM, Florian Rivoal wrote:
>> Hi Fantasai and Tab,

p.s. Please use fantasai.lists@ when CCing me on public
mailing lists! Thanks~

~fantasai

Reply | Threaded
Open this post in threaded view
|

Re: Tests for :focus and :focus-within

Florian Rivoal-4
In reply to this post by fantasai

> On 19 Sep 2015, at 06:00, fantasai <[hidden email]> wrote:
>
> On 09/18/2015 05:37 AM, Florian Rivoal wrote:
>> Hi Fantasai and Tab,
>>
>> Questions:
>> 1 - Does it make sense to do it as a ref-test, or should I give up on the reference, and simply have it as a manual test? This would allow me to avoid suppressing focus indicators.
>>
>> 2 - If I stay on the ref test (or manual test) approach, should I keep the helper js?
>
> Keep the helper JS. If we can run it automatically, that's very helpful
> for regression testing.
>
> Make sure you include class="reftest-wait" on the HTML element
> and remove it once JS has verified that the element has been
> focused (whether manually or via JS).

Do I need to remove it when the element was focussed manually and JS is off/not supported? If yes, how am I supposed to do that? Or is that only relevant if JS is running?

 - Florian
Reply | Threaded
Open this post in threaded view
|

Re: Tests for :focus and :focus-within

fantasai
On 09/19/2015 03:03 AM, Florian Rivoal wrote:

>
>> On 19 Sep 2015, at 06:00, fantasai <[hidden email]> wrote:
>>
>> On 09/18/2015 05:37 AM, Florian Rivoal wrote:
>>> Hi Fantasai and Tab,
>>>
>>> Questions:
>>> 1 - Does it make sense to do it as a ref-test, or should I give up on the reference, and simply have it as a manual test? This would allow me to avoid suppressing focus indicators.
>>>
>>> 2 - If I stay on the ref test (or manual test) approach, should I keep the helper js?
>>
>> Keep the helper JS. If we can run it automatically, that's very helpful
>> for regression testing.
>>
>> Make sure you include class="reftest-wait" on the HTML element
>> and remove it once JS has verified that the element has been
>> focused (whether manually or via JS).
>
> Do I need to remove it when the element was focussed manually and
> JS is off/not supported? If yes, how am I supposed to do that?
> Or is that only relevant if JS is running?

Only relevant if JS is running, of course, otherwise you can't run
JS... I suppose it doesn't much matter.

~fantasai