diff --git a/code-component/PowerDragDrop/ControlManifest.Input.xml b/code-component/PowerDragDrop/ControlManifest.Input.xml index b2a6f9e..b2eceae 100644 --- a/code-component/PowerDragDrop/ControlManifest.Input.xml +++ b/code-component/PowerDragDrop/ControlManifest.Input.xml @@ -1,6 +1,6 @@  - + @@ -44,6 +44,8 @@ + + 0 1 diff --git a/code-component/PowerDragDrop/ItemRenderer.ts b/code-component/PowerDragDrop/ItemRenderer.ts index a033395..b44cb84 100644 --- a/code-component/PowerDragDrop/ItemRenderer.ts +++ b/code-component/PowerDragDrop/ItemRenderer.ts @@ -174,6 +174,7 @@ export class ItemRenderer { return context.parameters.items.columns.filter((c) => c.order !== -1); } + // eslint-disable-next-line sonarjs/cognitive-complexity private updateContainerStyles(parameters: IInputs) { const mainContainer = this.mainContainer; const listContainer = this.listContainer; @@ -203,7 +204,21 @@ export class ItemRenderer { mainContainer.style.borderRadius = parameters.BorderRadius.raw + 'px'; } if (parameters.Scroll?.raw !== null) { - listContainer.style.overflow = parameters.Scroll?.raw ? 'auto' : 'hidden'; + const direction = parameters.Direction?.raw; + const scroll = parameters.Scroll.raw === true; + const wrap = parameters.Wrap?.raw === true; + listContainer.style.overflowX = + scroll && (direction !== DirectionEnum.Vertical || wrap) ? 'auto' : 'hidden'; + listContainer.style.overflowY = + scroll && (direction !== DirectionEnum.Horizontal || wrap) ? 'auto' : 'hidden'; + } + + if (parameters.AccessibleLabel?.raw !== null) { + listContainer.ariaLabel = parameters.AccessibleLabel.raw; + } + + if (parameters.AllowFocus?.raw !== null) { + listContainer.tabIndex = parameters.AllowFocus.raw ? 0 : -1; } } @@ -297,8 +312,11 @@ export class ItemRenderer { private createMessageElement(messageHtml: string): HTMLElement { const element = document.createElement('div'); - element.className = CSS_STYLE_CLASSES.Warning; - element.innerHTML = `${messageHtml}`; + element.className = CSS_STYLE_CLASSES.WarningContainer; + element.innerHTML = ` +
+ ${messageHtml} +
`; return element; } } diff --git a/code-component/PowerDragDrop/ManifestConstants.ts b/code-component/PowerDragDrop/ManifestConstants.ts index 10af9d3..f583349 100644 --- a/code-component/PowerDragDrop/ManifestConstants.ts +++ b/code-component/PowerDragDrop/ManifestConstants.ts @@ -33,6 +33,8 @@ export enum ManifestConstants { ItemGap = 'ItemGap', Direction = 'Direction', Wrap = 'Wrap', + AccessibleLabel = 'AccessibleLabel', + AllowFocus = 'AllowFocus', } export enum InputEvents { @@ -64,12 +66,16 @@ export const RENDER_TRIGGER_PROPERTIES: string[] = [ ManifestConstants.Scroll, ManifestConstants.Direction, ManifestConstants.Wrap, + ManifestConstants.AccessibleLabel, + ManifestConstants.AllowFocus, + ManifestConstants.DelaySelect, ]; export const ZONE_REGISTRATION_PROPERTIES: string[] = [ ManifestConstants.IsMasterZone, ManifestConstants.DropZoneID, ManifestConstants.OtherDropZoneIDs, + ManifestConstants.DelaySelect, ]; export const ZONE_OPTIONS_PROPERTIES: string[] = [ diff --git a/code-component/PowerDragDrop/Styles.ts b/code-component/PowerDragDrop/Styles.ts index bda9632..f7465fe 100644 --- a/code-component/PowerDragDrop/Styles.ts +++ b/code-component/PowerDragDrop/Styles.ts @@ -21,6 +21,7 @@ export enum CSS_STYLE_CLASSES { ItemValue = 'powerdnd-item-value', ActionClassPrefix = 'action-', Chosen = 'powerdnd-chosen', + WarningContainer = 'powerdnd-warning-container', Warning = 'powerdnd-warning', WarningIcon = 'powerdnd-warning-icon', } diff --git a/code-component/PowerDragDrop/__mocks__/mock-parameters.ts b/code-component/PowerDragDrop/__mocks__/mock-parameters.ts index a52b629..52b2543 100644 --- a/code-component/PowerDragDrop/__mocks__/mock-parameters.ts +++ b/code-component/PowerDragDrop/__mocks__/mock-parameters.ts @@ -62,5 +62,7 @@ export function getMockParameters(): IInputs { Trace: new MockTwoOptionsProperty(false), ItemSchema: new MockStringProperty(''), items: items, + AccessibleLabel: new MockStringProperty(''), + AllowFocus: new MockTwoOptionsProperty(false), }; } diff --git a/code-component/PowerDragDrop/__tests__/ItemRenderer.test.tsx b/code-component/PowerDragDrop/__tests__/ItemRenderer.test.tsx index b32a1b7..fea413a 100644 --- a/code-component/PowerDragDrop/__tests__/ItemRenderer.test.tsx +++ b/code-component/PowerDragDrop/__tests__/ItemRenderer.test.tsx @@ -21,7 +21,8 @@ describe('ItemRenderer', () => {
    `); @@ -44,7 +45,8 @@ describe('ItemRenderer', () => {
      `); @@ -62,7 +64,8 @@ describe('ItemRenderer', () => {
        `); @@ -82,7 +85,8 @@ describe('ItemRenderer', () => {
          `); diff --git a/code-component/PowerDragDrop/css/PowerDragDrop.css b/code-component/PowerDragDrop/css/PowerDragDrop.css index 2c2c917..935c2dc 100644 --- a/code-component/PowerDragDrop/css/PowerDragDrop.css +++ b/code-component/PowerDragDrop/css/PowerDragDrop.css @@ -1,5 +1,6 @@ .powerdnd-main-container { border-style: solid; + border-color: transparent; box-sizing: border-box; } @@ -57,6 +58,13 @@ li.powerdnd-item { transform: rotate(-15deg); } +.powerdnd-warning-container { + border-color: rgb(0,0,0,0.8); + border-width: 2px; + border-style: solid; + height: 100%; +} + .powerdnd-warning { display: flex; column-gap: 16px; diff --git a/code-component/PowerDragDrop/strings/PowerDragDrop.1033.resx b/code-component/PowerDragDrop/strings/PowerDragDrop.1033.resx index f14e37d..c9c11fe 100644 --- a/code-component/PowerDragDrop/strings/PowerDragDrop.1033.resx +++ b/code-component/PowerDragDrop/strings/PowerDragDrop.1033.resx @@ -303,4 +303,16 @@ Control wrapping of the items in the list + + Accessible Label + + + Screen reader aria label + + + Allow Focus + + + Can the drag drop area accept focus using tab. Screen readers will announce the name of the area and the number of items. + \ No newline at end of file