Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Management] Improve accessibility within management #13364

Merged
merged 16 commits into from
Aug 10, 2017

Conversation

chrisronline
Copy link
Contributor

Closes #12861
Closes #12862
Closes #12863
Closes #12865
Closes #12868
Closes #12870
Closes #11526

This PR addresses some low hanging fruit to improve accessibility within the management area.

Copy link
Contributor

@timroes timroes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments.

I moved the info icon in #13341. I moved it to the status page as suggested in the ticket, so I think we should also leave that PR open. But I guess we can merge yours and mine in the end without any problem.

<span ng-if="!sectionName" class="kuiLocalTab">
{{::section.display}}
</span>
<header ng-if="!sectionName" id="tabHeader" tabindex="0">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed (unfortunately after you already did this) in #12861 I don't see a reason, why we would add an id and tabindex here. That element is not interactive at all, why would we need to focus it?
I think it might have been confusing, since that title also has a cursor: pointer and hover color when using the mouse (but still no interactive content).

I would really appreciate @aphelionz feedback on this, but I think we should remove id and tabindex here and most likely also remove the pointer cursor and hover color?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree about the cursor: pointer and hover color here if it's not interactive. However I can go either way on it being tabbable based on the idea that I expressed in the other issue - orienting the user on the page and audibly saying the name of the section.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would then leave it like that. So just ignore that comment :-)

@@ -3,6 +3,7 @@
data-test-subj="indexPatternFieldEditButton"
ng-href="{{ kbnUrl.getRouteHref(field, 'edit') }}"
aria-label="Edit"
tabindex="0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a element with an href (or in this case ng-href) are automatically in taborder. This attribute isn't needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay good to know!

@@ -12,6 +13,7 @@
ng-if="field.scripted"
ng-click="remove(field)"
class="kuiButton kuiButton--danger kuiButton--small"
tabindex="0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buttons are automatically in taboder and this attribute can safely be removed.

@@ -73,6 +73,7 @@ <h1 class="kuiTitle">
class="kuiToolBarSearchBox__input"
type="text"
placeholder="Search..."
role="search"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

role=search should be on a parent diff, see my comments here

@@ -15,6 +15,7 @@
<kbn-info ng-if="col.info" info="{{ col.info }}" placement="top"></kbn-info>
<i
ng-if="col.sortable !== false"
tabindex="0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tabindex needs to be on the element, that also allows the click (ng-click). Also this only makes it focusable, but not "keyboard accessible", that the user can activate the action by keyboard. You would need to add the kbnAccessibleClick directive too.

@chrisronline
Copy link
Contributor Author

chrisronline commented Aug 7, 2017

Resolved those issues @timroes. Appreciate the deep dive!

<header ng-if="!sectionName" id="tabHeader" tabindex="0">
<h2 class="kuiLocalTab">
<header ng-if="!sectionName" id="tabHeader">
<h2>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should keep the class kuiLocalTab here. I think @timroes's comment was about removing the id and tabindex attributes. But I think we may actually want to revert this commit until @aphelionz has had a chance to explain how these attributes affect accessibility, since he's the one who established this pattern originally.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, as a general rule of thumb, we should avoid removing classes that affect the UI unless we're confident that this is a good change. In this case, this is a bad change because it introduces inconsistency between the headers of the different apps. Feel free to ping members of the design team with questions about this kind of stuff in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up @cjcenizal! I'll revert this back, or possibly introduce a new class that has the same styles sans the hover treatment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert done. Will wait until we hear from @aphelionz!

Copy link
Contributor

@cjcenizal cjcenizal Aug 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tab should have the .kuiLocalTab-isSelected class applied to it, which should do the trick.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

screen shot 2017-08-07 at 9 00 50 pm

That doesn't look right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I know what's wrong. We need to add margin: 0 to the kuiLocalTab class in the UI Framework. The <h2> elements introduces a margin, and this component's design doesn't anticipate this kind of use case.

@cjcenizal
Copy link
Contributor

Thanks for pinging me on this, @chrisronline! I'll wait until #13341 is merged and rebased onto this branch before I review, since that will simplify the diff.

@cjcenizal
Copy link
Contributor

@timroes It looks like @aphelionz explained his reasoning in #12861 (comment):

I've found that some users find having a tabbable heading helpful just for orientation, though I can be persuaded either way on this. As long as we're consistent it should be fine.

Seems to make sense to me. Thoughts?

Copy link
Contributor

@aphelionz aphelionz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might want to revisit the kuiLocalTab directive based on @timroes' feedback. There might be too much built in to one class declaration for a11y purposes

<span ng-if="!sectionName" class="kuiLocalTab">
{{::section.display}}
</span>
<header ng-if="!sectionName" id="tabHeader" tabindex="0">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree about the cursor: pointer and hover color here if it's not interactive. However I can go either way on it being tabbable based on the idea that I expressed in the other issue - orienting the user on the page and audibly saying the name of the section.

@timroes
Copy link
Contributor

timroes commented Aug 8, 2017

FYI: #13341 is merged. Could you maybe rebase to master again?

<input
ng-model="editor.field.name"
id="scriptedFieldName00------------"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, I forgot to add that comment yesterday: What has happened to this id? 🐱 ⌨️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That'd be my cat :) Thanks for pointing it out!

@timroes
Copy link
Contributor

timroes commented Aug 8, 2017

If you could still rebase it, fix the broken ID, I would be fine to give this a LGTM. I think we should move the discussion about kuiLocalTab into it's own issue, to not glut this PR.

@chrisronline chrisronline force-pushed the management/accessibility branch from 428017d to 124c3af Compare August 8, 2017 13:10
@chrisronline
Copy link
Contributor Author

@timroes Sounds good. Should I remove all changes in regards to header, or leave what I have?

@timroes
Copy link
Contributor

timroes commented Aug 8, 2017

I would leave it like it is currently.

@chrisronline
Copy link
Contributor Author

@timroes Great! PR has been rebased and ready for the last pass!

@timroes
Copy link
Contributor

timroes commented Aug 8, 2017

LGTM. I think we should think about the focus color/shadow in tables header, they look weird (in Chrome), but wouldn't consider this to be part of this PR.

Copy link
Contributor

@cjcenizal cjcenizal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Fantastic! I had a couple minor comments.

To fully address #12863, we also need to make sure we address the different parts of the form that become available when you choose different "Format" values:

image

We also need to address the "Create Index Pattern" form for this issue, but we can do that as part of #13154. I left a comment on that PR.

<h2 class="kuiLocalTab">
{{::section.display}}
</h2>
</header>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit, but I think the original issue had a slight error in that it referred to a "header", but really meant to refer to a "heading". So I think this markup should become this:

        <h2 class="kuiLocalTab" ng-if="!sectionName" id="tabHeader" tabindex="0">
          {{::section.display}}
        </h2>

@@ -10,6 +10,8 @@
<th
ng-repeat="col in columns"
ng-click="paginatedTable.sortColumn($index)"
kbn-accessible-click
tabindex="0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! @snide do you think you could fix the focus styles for these elements?

image

@chrisronline
Copy link
Contributor Author

@cjcenizal Great call out! Fixed and ready for another pass!

@@ -1,5 +1,6 @@
<div class="form-group">
<input
id="{{ id }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any requirement for a label here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha 👍

Copy link
Contributor

@cjcenizal cjcenizal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Had one minor concern.

// The id attribute is not always an angular expression but nearly always
// just a string passed in
$scope.id = attrs.id;
attrs.$observe('id', () => $scope.id = attrs.id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this directive needs replace: true, or else the directive shows up as a DOM element with an id on it, which I think will take precedence over the input's id.

Also, I think you can define this a little more simply via the scope property:

scope: {
  id: '@',
},

Did you already give that a shot?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might also want to double check my assertion about the id in the browser.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely right. Good call out

@chrisronline
Copy link
Contributor Author

Fixed up @cjcenizal. Ready for another pass!

Copy link
Contributor

@cjcenizal cjcenizal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@chrisronline chrisronline merged commit d12aa4b into elastic:master Aug 10, 2017
chrisronline added a commit that referenced this pull request Aug 10, 2017
* Use header/h tag for tab header, #12861

* Add tabindexes for tables, #12862

* Add for/id pairings, #12863

* Search role, #12868

* Use better descriptions for aria labels, #12865

* Add aria label, #12870

* Button and a tags are already in tab order, removing unnecessary change

* The input field cannot contain the role="search"

* The tabindex needs to be on the element which the click handler

* Remove tabindex and remove the class applying the hover styles - honestly, we can probably make due without any class (using default h2 styles)

* Revert "Remove tabindex and remove the class applying the hover styles - honestly, we can probably make due without any class (using default h2 styles)"

This reverts commit c54ea227889898baef85ee71b3350bbf69ef5d7c.

* Remove the extra code my cat added

* Addressing hidden inputs from #12863

* Remove unnecessary header tag

* Add clarifying comment

* Prevent multiple ids
chrisronline added a commit that referenced this pull request Aug 10, 2017
* Use header/h tag for tab header, #12861

* Add tabindexes for tables, #12862

* Add for/id pairings, #12863

* Search role, #12868

* Use better descriptions for aria labels, #12865

* Add aria label, #12870

* Button and a tags are already in tab order, removing unnecessary change

* The input field cannot contain the role="search"

* The tabindex needs to be on the element which the click handler

* Remove tabindex and remove the class applying the hover styles - honestly, we can probably make due without any class (using default h2 styles)

* Revert "Remove tabindex and remove the class applying the hover styles - honestly, we can probably make due without any class (using default h2 styles)"

This reverts commit c54ea227889898baef85ee71b3350bbf69ef5d7c.

* Remove the extra code my cat added

* Addressing hidden inputs from #12863

* Remove unnecessary header tag

* Add clarifying comment

* Prevent multiple ids
@chrisronline
Copy link
Contributor Author

Backport

6.0: 4df4671
6.x: 511ffa2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants