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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9ae1879
added missing label & keyboard accessbile dragndrop
blackbaud-conorwright Jul 10, 2018
448326a
added tests for accessible dnd. Added ArrowKey support
blackbaud-conorwright Jul 11, 2018
e35d8d5
fixed import reorganization
blackbaud-conorwright Jul 11, 2018
53ec73a
Merge branch 'master' into add-keyboard-accessible-dragondrop-to-tiles
blackbaud-conorwright Jul 11, 2018
c07c7e7
Merge remote-tracking branch 'upstream/master' into add-keyboard-acce…
blackbaud-conorwright Jul 16, 2018
1f6f078
Merge remote-tracking branch 'upstream/master' into add-keyboard-acce…
blackbaud-conorwright Jul 18, 2018
d3c2f75
switched to a shorter condition for movetile
blackbaud-conorwright Jul 18, 2018
f10974d
fixed missing coverage in tile service
blackbaud-conorwright Jul 30, 2018
f582c87
Merge branch 'master' into add-keyboard-accessible-dragondrop-to-tiles
blackbaud-conorwright Jul 30, 2018
c7eee81
Merge branch 'master' into add-keyboard-accessible-dragondrop-to-tiles
blackbaud-conorwright Jul 31, 2018
f1b25bf
fixed tile handle outline appearance
blackbaud-conorwright Jul 31, 2018
3029995
Merge branch 'add-keyboard-accessible-dragondrop-to-tiles' of github.…
blackbaud-conorwright Jul 31, 2018
4f1111f
Merge branch 'master' into add-keyboard-accessible-dragondrop-to-tiles
blackbaud-conorwright Aug 1, 2018
d9bf505
Merge branch 'master' into add-keyboard-accessible-dragondrop-to-tiles
Blackbaud-AlexKingman Aug 13, 2018
c957a57
Merge branch 'master' into add-keyboard-accessible-dragondrop-to-tiles
blackbaud-conorwright Aug 30, 2018
db61457
added better accessibility info. Fixed mobile nav
blackbaud-conorwright Aug 31, 2018
c8be2c2
removed leftover "fit"
blackbaud-conorwright Sep 4, 2018
4f268ba
Merge branch 'master' into add-keyboard-accessible-dragondrop-to-tiles
blackbaud-conorwright Sep 6, 2018
03cc1c3
addressed PR comments
blackbaud-conorwright Sep 6, 2018
ed609e8
Merge branch 'master' into add-keyboard-accessible-dragondrop-to-tiles
blackbaud-conorwright Sep 6, 2018
69f5d43
Merge branch 'master' into add-keyboard-accessible-dragondrop-to-tiles
blackbaud-conorwright Sep 7, 2018
a1dc3d2
Merge branch 'master' into add-keyboard-accessible-dragondrop-to-tiles
blackbaud-conorwright Sep 10, 2018
279c817
Merge branch 'master' into add-keyboard-accessible-dragondrop-to-tiles
blackbaud-conorwright Sep 12, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/locales/resources_en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,14 @@
"_description": "Label for settings button in the tile",
"message": "Settings"
},
"tile_grab_handle": {
"_description": "Label for grab handle in the tile",
"message": "Use arrow keys to reorder. Press up and down arrow keys to change position in column. Press left and right arrow keys to change position to another column."
},
"tile_moved_assistive_text": {
"_description": "Report of the new location of a recently moved tile",
"message": "{0} moved. Current column: {1} of {2}. Current position in column: {3} of {4}"
},
"timepicker_button_label": {
"_description": "Screen reader text for the timepicker component dropdown button",
"message": "Choose time"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface SkyTileDashboardConfigReorderData {
tileDescription: string;
column: number;
position: number;
}
12 changes: 10 additions & 2 deletions src/modules/tiles/tile-dashboard-config/tile-dashboard-config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { SkyTileDashboardConfigLayout } from './tile-dashboard-config-layout';
import { SkyTileDashboardConfigTile } from './tile-dashboard-config-tile';
import {
SkyTileDashboardConfigLayout
} from './tile-dashboard-config-layout';
import {
SkyTileDashboardConfigTile
} from './tile-dashboard-config-tile';
import {
SkyTileDashboardConfigReorderData
} from './tile-dashboard-config-reorder-data';

export interface SkyTileDashboardConfig {
tiles: SkyTileDashboardConfigTile[];
layout: SkyTileDashboardConfigLayout;
movedTile?: SkyTileDashboardConfigReorderData;
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
import { Component, ViewChild } from '@angular/core';
import {
Component,
ViewChild
} from '@angular/core';

import { SkyTileDashboardComponent, SkyTileDashboardConfig } from '../../../tiles';
import { Tile1TestComponent } from './tile1.component.fixture';
import { Tile2TestComponent } from './tile2.component.fixture';
import {
SkyTileDashboardConfig
} from '../../tile-dashboard-config';
import {
SkyTileDashboardComponent
} from '../../tile-dashboard';

import { TileTestContext } from './tile-context.fixture';
import {
Tile1TestComponent
} from './tile1.component.fixture';
import {
Tile2TestComponent
} from './tile2.component.fixture';
import {
TileTestContext
} from './tile-context.fixture';

@Component({
selector: 'sky-demo-app',
Expand Down Expand Up @@ -34,6 +48,30 @@ export class TileDashboardTestComponent {
}
}
]
},
{
id: 'sky-test-tile-3',
componentType: Tile2TestComponent,
providers: [
{
provide: TileTestContext,
useValue: {
id: 3
}
}
]
},
{
id: 'sky-test-tile-4',
componentType: Tile2TestComponent,
providers: [
{
provide: TileTestContext,
useValue: {
id: 3
}
}
]
}
],
layout: {
Expand All @@ -46,6 +84,14 @@ export class TileDashboardTestComponent {
{
id: 'sky-test-tile-1',
isCollapsed: true
},
{
id: 'sky-test-tile-3',
isCollapsed: false
},
{
id: 'sky-test-tile-4',
isCollapsed: false
}
]
},
Expand All @@ -55,6 +101,14 @@ export class TileDashboardTestComponent {
{
id: 'sky-test-tile-1',
isCollapsed: true
},
{
id: 'sky-test-tile-3',
isCollapsed: false
},
{
id: 'sky-test-tile-4',
isCollapsed: false
}
]
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<span
aria-live="assertive"
class="sky-assistive-text"
>
{{ tileMovedReport }}
</span>
<sky-tile-dashboard-column
*ngFor="let column of config?.layout?.multiColumn"
class="sky-tile-dashboard-layout-multi"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,9 @@
margin-bottom: 0 !important;
}
}

.sky-assistive-text {
@media screen {
@include sky-screen-reader-only();
}
}
45 changes: 41 additions & 4 deletions src/modules/tiles/tile-dashboard/tile-dashboard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,23 @@ import {
ViewChildren
} from '@angular/core';

import { SkyTileDashboardColumnComponent } from '../tile-dashboard-column';
import { SkyTileDashboardConfig } from '../tile-dashboard-config';
import { SkyTileDashboardService } from './tile-dashboard.service';
import {
SkyResources
} from '../../resources';
import {
SkyMediaQueryService,
SkyMediaBreakpoints
} from '../../media-queries';

import {
SkyTileDashboardColumnComponent
} from '../tile-dashboard-column';
import {
SkyTileDashboardConfig
} from '../tile-dashboard-config';
import {
SkyTileDashboardService
} from './tile-dashboard.service';

@Component({
selector: 'sky-tile-dashboard',
Expand Down Expand Up @@ -43,6 +57,8 @@ export class SkyTileDashboardComponent implements AfterViewInit, OnDestroy {
@ViewChild('singleColumn', {read: SkyTileDashboardColumnComponent})
public singleColumn: SkyTileDashboardColumnComponent;

public tileMovedReport: string;

private _config: SkyTileDashboardConfig;

private configSet = false;
Expand All @@ -52,10 +68,31 @@ export class SkyTileDashboardComponent implements AfterViewInit, OnDestroy {
constructor(
// HACK: This is public so it can be accessed via a unit test due to breaking changes
// in RC5. https://github.com/angular/angular/issues/10854
public dashboardService: SkyTileDashboardService
public dashboardService: SkyTileDashboardService,
private mediaQuery: SkyMediaQueryService
) {
dashboardService.configChange.subscribe((config: SkyTileDashboardConfig) => {
this.configChange.emit(config);

// Update aria live region with tile drag info
if (config.movedTile) {
let message = SkyResources.getString('tile_moved_assistive_text');
message = message.replace('{0}', config.movedTile.tileDescription);
message = message.replace('{3}', config.movedTile.position.toString());
if (
this.mediaQuery.current === SkyMediaBreakpoints.xs ||
this.mediaQuery.current === SkyMediaBreakpoints.sm
) {
message = message.replace('{1}', '1');
message = message.replace('{2}', '1');
message = message.replace('{4}', config.layout.singleColumn.tiles.length.toString());
} else {
message = message.replace('{1}', config.movedTile.column.toString());
message = message.replace('{2}', config.layout.multiColumn.length.toString());
message = message.replace('{4}', config.layout.multiColumn[config.movedTile.column - 1].tiles.length.toString());
}
this.tileMovedReport = message;
}
});
}

Expand Down
2 changes: 2 additions & 0 deletions src/modules/tiles/tile-dashboard/tile-dashboard.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { DragulaService } from 'ng2-dragula/ng2-dragula';
import { SkyTileDashboardComponent } from './tile-dashboard.component';
import { SkyTileDashboardColumnModule } from '../tile-dashboard-column';
import { SkyMediaQueryModule } from '../../media-queries';
import { SkyResourcesModule } from '../../resources';

@NgModule({
declarations: [
Expand All @@ -17,6 +18,7 @@ import { SkyMediaQueryModule } from '../../media-queries';
imports: [
CommonModule,
SkyTileDashboardColumnModule,
SkyResourcesModule,
SkyMediaQueryModule
],
exports: [
Expand Down
Loading