Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Add keyboard accessible dragondrop to tiles #1815

Merged

Conversation

blackbaud-conorwright
Copy link
Contributor

  • Added missing aria-label for the tile drag handle.
  • Implemented arrow key operation of tile position within and between columns

Resolves: #1371 and #1372

@codecov-io
Copy link

codecov-io commented Jul 11, 2018

Codecov Report

Merging #1815 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #1815   +/-   ##
======================================
  Coverage     100%    100%           
======================================
  Files         422     424    +2     
  Lines        8993    9056   +63     
  Branches     1332    1355   +23     
======================================
+ Hits         8993    9056   +63
Impacted Files Coverage Δ
...les/tiles/tile-dashboard/tile-dashboard.service.ts 100% <100%> (ø) ⬆️
...ules/tiles/tile-dashboard/tile-dashboard.module.ts 100% <100%> (ø) ⬆️
src/modules/tiles/tile/tile.module.ts 100% <100%> (ø) ⬆️
...s/tiles/tile-dashboard/tile-dashboard.component.ts 100% <100%> (ø) ⬆️
src/modules/tiles/tile/tile.component.ts 100% <100%> (ø) ⬆️
src/modules/radio/radio.component.ts 100% <0%> (ø) ⬆️
src/modules/flyout/flyout.module.ts 100% <0%> (ø) ⬆️
src/modules/toast/toast.module.ts 100% <0%> (ø) ⬆️
src/modules/log/log.service.ts 100% <0%> (ø) ⬆️
src/modules/log/log.module.ts 100% <0%> (ø) ⬆️
... and 33 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 949cfd1...279c817. Read the comment docs.

@Blackbaud-AlexKingman
Copy link
Contributor

@blackbaud-conorwright this is looking good. Couple questions:

  1. I noticed the click target for the move handle is shaped differently than the other two buttons. I'm assuming this is to make it easier to grab with the mouse? If so, maybe that's OK then. If not, should we look at modifying padding/margins to make that match the others?
  2. Is using arrow keys to move an element an established convention for folks with assistive tech? For example, will they know if they hear an element called "Move" that the next thing they should do is use the arrow keys? I only ask this because I wonder if there's a way to instruct a user what to do in this scenario - maybe the label could say "Move with arrow keys" or perhaps there's another aria tag to expand upon this?

@blackbaud-conorwright
Copy link
Contributor Author

Hey @Blackbaud-AlexKingman
I'll run the label issue by Matt, it may not be intuitive enough. I think the ArrowKey use is common enough though, just may need a better descriptor.
For 1 though, I'm not sure what you mean here. I don't believe I altered the handle appearance and at least on my screen it looks to be the same size and spacing as the other 2 icons in the demo. Do you mean that it is a different icon or am I missing the issue?

@Blackbaud-AlexKingman
Copy link
Contributor

Here's what I mean about the focus target being different from the others:
screen shot 2018-07-31 at 11 10 00 am

If you take a look at the other buttons, its a nice equal square.

@Blackbaud-AlexKingman
Copy link
Contributor

@blackbaud-conorwright your click-target changes look good! Any news back from Matt re: label clarification?

@blackbaud-conorwright
Copy link
Contributor Author

Not yet, I think he might be rather busy this week. I may ping him again later today if I don't hear back.

@Blackbaud-AlexKingman
Copy link
Contributor

@blackbaud-conorwright I may have found a nice pattern that will improve the accessibility here. Check out "Pattern #1: Sorting a List" from this article.

tl;dr

  <span id="operation" class="assistive-text">
    Press Arrow Key to reorder
  </span>
  ...
  <li role="option" draggable="true" aria-describedby="operation" 
      tabindex="0">
    Ice Cream
  </li>

When tabbing in to the first list-item, it will read,

“Listbox. 1 of X. Ice Cream. Press Arrow Key to reorder.”

What do you think of this @Blackbaud-MattGregg ?

@Blackbaud-MattGregg
Copy link
Contributor

I think that pattern looks promising. Looks great with use of Live region and feedback on where item is positioned after changes.
For the tiles scenario, it would need to be tweaked slightly given that example has a different semantic structure. Their example uses the aria-describedby because it's it's an item in a list and already has a label value. The tiles icons elements seems to be missing a role so would probably need one and a text label for example.

if (this.config && this.config.layout.multiColumn) {
for (let column of this.config.layout.multiColumn) {
/*istanbul ignore else */
if (column.tiles) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious - would this be more clear with a .find() instead of a for() loop? I don't have a good answer, just curious about your thoughts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh nice, yeah that would be more efficient 😄
swapped

@@ -159,6 +145,100 @@ export class SkyTileDashboardService {
}
}

public moveTile(tileCmp: SkyTileComponent, direction: string, tileDescription: string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is only utilized via keyboard commands, should we make the method name more specific? Something like moveTileOnKeyDown?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that would be a better name. Changing

}

// Move the tile element in the document
let tileComponentInstance = this.getTileComponent(tileId);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe being paranoid here, but should we do a null check on tileComponentInstance ? Is there a chance of that ever being null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a check :)
It seems very unlikely since I pass in the component instance but this tie in could be bumped eventually with mismatch between the document and our internal map of the tiles

column.tiles = column.tiles.filter(item => item !== tile);
this.moveTilesToColumn(this.columns.toArray()[colIndex + operator], [tile]);

// Report the change in configuration
Copy link
Contributor

Choose a reason for hiding this comment

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

I see this report feature a couple times in here. Should we encapsulate it to its own method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think it's really worth it here. All I'm doing is constructing the object and the difference between these two calls are nearly all of the logic.

@Blackbaud-AlexKingman
Copy link
Contributor

I like the changes. Much cleaner! Great job. 🚢 🇮🇹!

@blackbaud-conorwright blackbaud-conorwright merged commit 2a5ec24 into master Sep 12, 2018
@blackbaud-conorwright blackbaud-conorwright deleted the add-keyboard-accessible-dragondrop-to-tiles branch September 12, 2018 20:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants