From bc9c9436d9d9f3f69a3259845d886eab15147b05 Mon Sep 17 00:00:00 2001 From: Jason Sylvestre Date: Mon, 16 Nov 2026 15:47:12 -0800 Subject: [PATCH 1/4] fix: Address WCAG Level A accessibility issues in forms and tables This commit resolves multiple WCAG Level A findings to improve usability for screen reader, speech input, and keyboard users. Key changes include: - Associating form controls with visible labels using unique IDs. - Providing explicit, meaningful headers for table columns (e.g., 'Details', 'Actions'). - Ensuring interactive elements, help links, and loading states have descriptive accessible names. - Making count explanations (e.g., "In Use / Total") directly visible instead of relying on inaccessible tooltips. - Correctly marking filter cells as data cells (``) instead of headers (``). --- .../Access/AccessAssignmentTable.tsx | 2 +- .../Access/AccessContainer.test.tsx | 2 +- .../components/Access/AccessEditValues.tsx | 12 +- .../src/components/Access/AccessList.tsx | 2 +- .../src/components/Access/AccessTable.tsx | 2 +- .../src/components/Access/SearchAccess.tsx | 7 +- .../Equipment/EquipmentAttributes.tsx | 1 + .../Equipment/EquipmentContainer.test.tsx | 56 +++++-- .../Equipment/EquipmentEditValues.tsx | 47 +++--- .../components/Equipment/EquipmentList.tsx | 2 +- .../Equipment/EquipmentManagedSystem.tsx | 3 +- .../EquipmentManagedSystemSearchId.tsx | 15 +- .../components/Equipment/EquipmentTable.tsx | 2 +- .../components/Equipment/SearchEquipment.tsx | 7 +- .../src/components/Keys/AssignKeySerial.tsx | 6 +- .../src/components/Keys/AssociateSpace.tsx | 11 +- .../src/components/Keys/KeyContainer.test.tsx | 2 +- .../src/components/Keys/KeyEditValues.tsx | 16 +- .../ClientApp/src/components/Keys/KeyList.tsx | 9 +- .../Keys/KeySerialContainer.test.tsx | 2 +- .../components/Keys/KeySerialEditValues.tsx | 14 +- .../src/components/Keys/KeySerialList.tsx | 2 +- .../src/components/Keys/KeySerialTable.tsx | 2 +- .../src/components/Keys/KeyTable.tsx | 13 +- .../src/components/Keys/SearchKeySerials.tsx | 7 +- .../src/components/Keys/SearchKeys.tsx | 8 +- .../src/components/People/AssignPerson.tsx | 7 +- .../People/PeopleContainer.test.tsx | 2 +- .../src/components/People/PeopleTable.tsx | 2 +- .../Shared/DropdownScrolling.test.tsx | 4 +- .../src/components/Shared/Filtering.tsx | 4 +- .../Shared/ReadOnlyAssetValues.test.tsx | 67 +++++++++ .../Shared/SearchAsyncOptions.test.tsx | 51 ++++++- .../components/Shared/SearchAsyncOptions.tsx | 3 + .../components/Shared/SearchCombobox.test.tsx | 22 +++ .../src/components/Shared/SearchCombobox.tsx | 3 +- .../Shared/TableCompatibility.test.tsx | 33 +++++ .../components/Shared/TableFilters.test.tsx | 19 +++ .../src/components/Spaces/SearchSpaces.tsx | 8 +- .../Spaces/SpacesContainer.test.tsx | 2 +- .../src/components/Spaces/SpacesList.tsx | 2 +- .../src/components/Spaces/SpacesTable.tsx | 14 +- .../Workstations/SearchWorkstations.tsx | 7 +- .../WorkstationContainer.test.tsx | 2 +- .../Workstations/WorkstationEditValues.tsx | 17 ++- .../Workstations/WorkstationList.tsx | 2 +- .../ClientApp/src/styles/asset-tables.css | 2 +- Keas.Mvc/Views/Admin/Index.cshtml | 4 +- Keas.Mvc/Views/DocumentSettings/Index.cshtml | 2 +- .../Group/IncompleteDocumentsReport.cshtml | 2 +- .../Group/PeopleLeavingWithAssets.cshtml | 2 +- Keas.Mvc/Views/Report/ActionsByAdmins.cshtml | 2 +- Keas.Mvc/Views/Report/InactiveSpaces.cshtml | 2 +- Keas.Mvc/Views/Report/PeopleInTeam.cshtml | 2 +- .../Report/PeopleLeavingWithAssets.cshtml | 2 +- .../PeopleWithIncompleteDocuments.cshtml | 2 +- .../PersonEquipmentHistoryReport.cshtml | 2 +- .../Report/SupervisorDirectReports.cshtml | 2 +- docs/accessibility-level-a-issue.md | 138 ++++++++++++++++++ 59 files changed, 537 insertions(+), 150 deletions(-) create mode 100644 docs/accessibility-level-a-issue.md diff --git a/Keas.Mvc/ClientApp/src/components/Access/AccessAssignmentTable.tsx b/Keas.Mvc/ClientApp/src/components/Access/AccessAssignmentTable.tsx index 297ac5e60..dce703169 100644 --- a/Keas.Mvc/ClientApp/src/components/Access/AccessAssignmentTable.tsx +++ b/Keas.Mvc/ClientApp/src/components/Access/AccessAssignmentTable.tsx @@ -45,7 +45,7 @@ const AccessAssignmentTable = (props: IProps) => { onClick={() => props.showDetails(data.row.original)} /> ), - header: ' ' + header: 'Details' }, { header: 'Assignment', diff --git a/Keas.Mvc/ClientApp/src/components/Access/AccessContainer.test.tsx b/Keas.Mvc/ClientApp/src/components/Access/AccessContainer.test.tsx index b7b1ea1e5..452222cd7 100644 --- a/Keas.Mvc/ClientApp/src/components/Access/AccessContainer.test.tsx +++ b/Keas.Mvc/ClientApp/src/components/Access/AccessContainer.test.tsx @@ -63,7 +63,7 @@ describe('Access Container', () => { const headerRecord = container.querySelector('.table-row').textContent; expect(headerRecord).toBe( - ' NameNumber of AssignmentsAssigned ToFirst ExpirationActions' + 'DetailsNameNumber of AssignmentsAssigned ToFirst ExpirationActions' ); }); diff --git a/Keas.Mvc/ClientApp/src/components/Access/AccessEditValues.tsx b/Keas.Mvc/ClientApp/src/components/Access/AccessEditValues.tsx index c2f8b3d8f..be304a766 100644 --- a/Keas.Mvc/ClientApp/src/components/Access/AccessEditValues.tsx +++ b/Keas.Mvc/ClientApp/src/components/Access/AccessEditValues.tsx @@ -1,5 +1,6 @@ import { AssetSummary } from '../Shared/AssetSummary'; import { LinkIcon } from '@heroicons/react/24/outline'; +import { useId } from 'react'; import { Button, FormFeedback, FormGroup, Input, Label } from 'reactstrap'; import { IAccess } from '../../models/Access'; import { IValidationError } from '../../models/Shared'; @@ -15,6 +16,7 @@ interface IProps { } const AccessEditValues = (props: IProps) => { + const formId = useId(); if (!props.disableEditing && !props.onAccessUpdate) { throw new Error( 'If the access is editable then a callback must be provided' @@ -45,8 +47,9 @@ const AccessEditValues = (props: IProps) => {
- + { - + { - + { props.onAccessUpdate({ ...access, tags: e.join(',') }); }} placeholder='Search for Tags' - id='searchTags' + id={`${formId}-tags`} /> {error && error.path === 'tags' && error.message} diff --git a/Keas.Mvc/ClientApp/src/components/Access/AccessList.tsx b/Keas.Mvc/ClientApp/src/components/Access/AccessList.tsx index aae00726d..fe5930331 100644 --- a/Keas.Mvc/ClientApp/src/components/Access/AccessList.tsx +++ b/Keas.Mvc/ClientApp/src/components/Access/AccessList.tsx @@ -34,7 +34,7 @@ const AccessAssignmentList = (props: IProps) => { - diff --git a/Keas.Mvc/ClientApp/src/components/Access/AccessTable.tsx b/Keas.Mvc/ClientApp/src/components/Access/AccessTable.tsx index da8b52e2e..3f900f70d 100644 --- a/Keas.Mvc/ClientApp/src/components/Access/AccessTable.tsx +++ b/Keas.Mvc/ClientApp/src/components/Access/AccessTable.tsx @@ -54,7 +54,7 @@ const AccessTable = (props: IProps) => { onClick={() => props.showDetails(data.row.original)} /> ), - header: ' ' + header: 'Details' }, { header: 'Name', diff --git a/Keas.Mvc/ClientApp/src/components/Access/SearchAccess.tsx b/Keas.Mvc/ClientApp/src/components/Access/SearchAccess.tsx index 8d6faa8cd..dc4417c08 100644 --- a/Keas.Mvc/ClientApp/src/components/Access/SearchAccess.tsx +++ b/Keas.Mvc/ClientApp/src/components/Access/SearchAccess.tsx @@ -1,5 +1,5 @@ import { PlusIcon } from '@heroicons/react/24/outline'; -import { useContext, useState } from 'react'; +import { useContext, useId, useState } from 'react'; import { Highlighter } from '../Shared/SearchCombobox'; import { toast } from 'react-toastify'; import { Button } from 'reactstrap'; @@ -15,6 +15,7 @@ interface IProps { // Search for existing access then send selection back to parent const SearchAccess = (props: IProps) => { + const inputId = useId(); const [accesses, setAccesses] = useState([]); const [isSearchLoading, setIsSearchLoading] = useState(false); const context = useContext(Context); @@ -22,10 +23,10 @@ const SearchAccess = (props: IProps) => { const renderSelectAccess = () => { return (
- +
{
{' '} { document.body.appendChild(container); }); +describe('Managed-system search accessibility', () => { + it('labels the input and pending action while preserving result selection', async () => { + let resolveSearch: (value: unknown) => void; + const fetch = vi.fn(() => new Promise(resolve => { resolveSearch = resolve; })); + const select = vi.fn(); + render( + + + , + { container } + ); + + fireEvent.click(screen.getByRole('button', { name: 'Look Up' })); + const dialog = await screen.findByRole('dialog', { name: 'Search by Computer Property' }); + const property = within(dialog).getByRole('textbox', { name: 'Computer Property' }); + expect(within(dialog).getByLabelText('Computer Property')).toBe(property); + fireEvent.change(property, { target: { value: 'Research' } }); + fireEvent.click(within(dialog).getByRole('button', { name: 'Search!' })); + + const pending = within(dialog).getByRole('button', { name: 'Searching…' }); + expect(pending).toBeDisabled(); + expect(pending).toHaveAttribute('aria-busy', 'true'); + expect(fetch).toHaveBeenCalledExactlyOnceWith('/api/team/equipment/GetComputersBySearch?value=Research'); + + await act(async () => resolveSearch({ result: [{ + hardware_u_bigfix_id: '123', + hardware_display_name: 'Research laptop', + hardware_u_device_name: 'LAB-01' + }] })); + expect(within(dialog).getByRole('button', { name: 'Search!' })).toBeEnabled(); + fireEvent.click(within(dialog).getByRole('button', { name: 'Research laptop (LAB-01)' })); + expect(select).toHaveBeenCalledExactlyOnceWith('systemManagementId', '123'); + }); +}); + describe('Equipment duplication', () => { beforeEach(() => { // The date picker measures text with canvas, which jsdom does not implement. @@ -126,7 +162,7 @@ describe('Equipment duplication', () => { const saveCopy = () => fireEvent.click(screen.getByRole('button', { name: 'Save' })); const selectOtherPerson = async (name: string) => { - fireEvent.change(screen.getByRole('combobox', { name: 'Search for person by name or email' }), { target: { value: name } }); + fireEvent.change(screen.getByRole('combobox', { name: 'Assign to' }), { target: { value: name } }); fireEvent.click(await screen.findByRole('option', { name: new RegExp(name) })); }; @@ -141,7 +177,7 @@ describe('Equipment duplication', () => { expect(screen.getByLabelText('Make')).toHaveValue(state.source.make); expect(screen.getByLabelText('Model')).toHaveValue(state.source.model); expect(screen.getByLabelText('Attribute value 1')).toHaveValue('5'); - expect(screen.getByRole('combobox', { name: 'Search for person by name or email' })).toHaveValue(''); + expect(screen.getByRole('combobox', { name: 'Assign to' })).toHaveValue(''); fireEvent.change(screen.getByLabelText('Name'), { target: { value: 'New laptop' } }); fireEvent.change(screen.getByLabelText('Serial Number / Identifier'), { target: { value: 'NEW-SERIAL' } }); fireEvent.change(screen.getByLabelText('Attribute value 1'), { target: { value: '6' } }); @@ -182,7 +218,7 @@ describe('Equipment duplication', () => { it('prevents Enter in a pending person search from submitting a new equipment record', async () => { const state = await setup(); - const personSearch = screen.getByRole('combobox', { name: 'Search for person by name or email' }); + const personSearch = screen.getByRole('combobox', { name: 'Assign to' }); fireEvent.change(personSearch, { target: { value: 'Searching' } }); expect(fireEvent.keyDown(personSearch, { key: 'Enter', code: 'Enter' })).toBe(false); expect(state.duplicate).not.toHaveBeenCalled(); @@ -228,7 +264,7 @@ describe('Equipment duplication', () => { expect(await screen.findByRole('alert')).toHaveTextContent('assignment could not be confirmed'); expect(state.assetInUseUpdated).not.toHaveBeenCalled(); - fireEvent.change(screen.getByRole('combobox', { name: 'Search for person by name or email' }), { target: { value: '' } }); + fireEvent.change(screen.getByRole('combobox', { name: 'Assign to' }), { target: { value: '' } }); fireEvent.click(screen.getByRole('button', { name: 'Save assignment' })); expect(await screen.findByRole('alert')).toHaveTextContent(`already assigned to ${state.otherPerson.name}`); @@ -263,7 +299,7 @@ describe('Equipment duplication', () => { saveCopy(); expect(await screen.findByRole('alert')).toHaveTextContent('assignment could not be confirmed'); - fireEvent.change(screen.getByRole('combobox', { name: 'Search for person by name or email' }), { target: { value: '' } }); + fireEvent.change(screen.getByRole('combobox', { name: 'Assign to' }), { target: { value: '' } }); fireEvent.click(screen.getByRole('button', { name: 'Save assignment' })); await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument()); @@ -283,7 +319,7 @@ describe('Equipment duplication', () => { expect(await screen.findByRole('alert')).toHaveTextContent('assignment could not be confirmed'); state.details.mockRejectedValueOnce(new Error('Details unavailable')); - fireEvent.change(screen.getByRole('combobox', { name: 'Search for person by name or email' }), { target: { value: '' } }); + fireEvent.change(screen.getByRole('combobox', { name: 'Assign to' }), { target: { value: '' } }); fireEvent.click(screen.getByRole('button', { name: 'Save assignment' })); expect(await screen.findByRole('alert')).toHaveTextContent('Unable to verify the saved assignment'); @@ -297,7 +333,7 @@ describe('Equipment duplication', () => { it('allows changing the person from a person page without adding the copy to the original person', async () => { const state = await setup({ view: 'person' }); - expect(screen.getByRole('combobox', { name: 'Search for person by name or email' })).toHaveValue(`${state.person.name} (${state.person.email})`); + expect(screen.getByRole('combobox', { name: 'Assign to' })).toHaveValue(`${state.person.name} (${state.person.email})`); await selectOtherPerson(state.otherPerson.name); fireEvent.change(screen.getByLabelText('Name'), { target: { value: 'Other person copy' } }); saveCopy(); @@ -311,7 +347,7 @@ describe('Equipment duplication', () => { it('allows clearing the person and saves unassigned outside that person’s list', async () => { const state = await setup({ view: 'person' }); - fireEvent.change(screen.getByRole('combobox', { name: 'Search for person by name or email' }), { target: { value: '' } }); + fireEvent.change(screen.getByRole('combobox', { name: 'Assign to' }), { target: { value: '' } }); fireEvent.change(screen.getByLabelText('Name'), { target: { value: 'Unassigned copy' } }); saveCopy(); @@ -323,7 +359,7 @@ describe('Equipment duplication', () => { it('excludes a copy from the space page when its room is cleared', async () => { const state = await setup({ view: 'space' }); - const spaceInput = screen.getByRole('combobox', { name: 'Search for space' }); + const spaceInput = screen.getByRole('combobox', { name: 'Room' }); fireEvent.click(within(spaceInput.parentElement).getByRole('button', { name: 'Clear selection' })); fireEvent.change(screen.getByLabelText('Name'), { target: { value: 'Roomless copy' } }); saveCopy(); @@ -383,7 +419,7 @@ describe('Equipment Container', () => { }); const headerRecord = container.querySelector('.table-row').textContent; - expect(headerRecord).toBe(' Serial NumberNameAssigned ToExpirationActions'); + expect(headerRecord).toBe('DetailsSerial NumberNameAssigned ToExpirationActions'); }); it('Shows Add Button', async () => { diff --git a/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentEditValues.tsx b/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentEditValues.tsx index 9b25413e9..2ba0ab22b 100644 --- a/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentEditValues.tsx +++ b/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentEditValues.tsx @@ -34,6 +34,7 @@ interface IProps { } const EquipmentEditValues = (props: IProps) => { + const formId = React.useId(); const typeValue = props.selectedEquipment.type || 'Default'; const listItems = !!props.equipmentTypes ? ( props.equipmentTypes.map(x => ( @@ -123,9 +124,9 @@ const EquipmentEditValues = (props: IProps) => {
- + { - + { - + { ) && ( <> - {' '} + {' '} { { - {' '} + {' '} { { {shouldShowForType(props.selectedEquipment.type, 'Make') && ( - + { )} {shouldShowForType(props.selectedEquipment.type, 'Model') && ( - + { ) && ( { )} - + {
- + { } onSelect={e => props.changeProperty('tags', e.join(','))} placeholder='Search for Tags' - id='searchTagsEquipmentEditValues' + id={`${formId}-tags`} /> {error && error.path === 'tags' && error.message} @@ -363,8 +368,9 @@ const EquipmentEditValues = (props: IProps) => { {props.disableEditing && ( // if we are looking at details, or if we are assigning - + { {!props.disableEditing && ( // if we are editing or creating - + {
+ Details Name Assigned? Number of Assignments
- diff --git a/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentManagedSystem.tsx b/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentManagedSystem.tsx index 84dc1b7e7..8275dcbc1 100644 --- a/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentManagedSystem.tsx +++ b/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentManagedSystem.tsx @@ -2,6 +2,7 @@ import EquipmentManagedSystemInfo from './EquipmentManagedSystemInfo'; import EquipmentManagedSystemSearchId from './EquipmentManagedSystemSearchId'; interface IProps { + inputId: string; managedSystemId: string; addManagedSystemId: (property: string, id: string) => void; disableEditing: boolean; @@ -28,7 +29,7 @@ const EquipmentManagedSystem = (props: IProps) => { return ( <>
- Managed System ID + {renderManagedSystemInfoOrSearchId()}
diff --git a/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentManagedSystemSearchId.tsx b/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentManagedSystemSearchId.tsx index 716ae4240..344b87cd3 100644 --- a/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentManagedSystemSearchId.tsx +++ b/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentManagedSystemSearchId.tsx @@ -1,6 +1,6 @@ import { Modal, ModalBody, ModalFooter, ModalHeading } from '../Shared/AppModal'; import { ArrowPathIcon, MagnifyingGlassIcon } from '@heroicons/react/24/outline'; -import { useContext, useState } from 'react'; +import { useContext, useId, useState } from 'react'; import { toast } from 'react-toastify'; import { Button, Form, FormFeedback, FormGroup, Input, Table } from 'reactstrap'; import { Context } from '../../Context'; @@ -11,6 +11,7 @@ interface IProps { } const EquipmentManagedSystemSearchId = (props: IProps) => { + const propertyId = useId(); const [isFetched, setIsFetched] = useState(false); const [isSearching, setIsSearching] = useState(false); const [isValidSearch, setIsValidSearch] = useState(true); @@ -76,11 +77,11 @@ const EquipmentManagedSystemSearchId = (props: IProps) => { const renderInputSearch = () => { return ( <> - + { @@ -146,14 +147,14 @@ const EquipmentManagedSystemSearchId = (props: IProps) => { const renderSearchButton = () => { if (isSearching) { return ( - ); } else { return ( - ); diff --git a/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentTable.tsx b/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentTable.tsx index eb4b2053f..299f7c2a9 100644 --- a/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentTable.tsx +++ b/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentTable.tsx @@ -68,7 +68,7 @@ const EquipmentTable = (props: IProps) => { onClick={() => props.showDetails(data.row.original)} /> ), - header: ' ' + header: 'Details' }, { header: 'Serial Number', diff --git a/Keas.Mvc/ClientApp/src/components/Equipment/SearchEquipment.tsx b/Keas.Mvc/ClientApp/src/components/Equipment/SearchEquipment.tsx index 002cbf456..0474d3788 100644 --- a/Keas.Mvc/ClientApp/src/components/Equipment/SearchEquipment.tsx +++ b/Keas.Mvc/ClientApp/src/components/Equipment/SearchEquipment.tsx @@ -1,5 +1,5 @@ import { PlusIcon } from '@heroicons/react/24/outline'; -import { useContext, useState } from 'react'; +import { useContext, useId, useState } from 'react'; import { Highlighter } from '../Shared/SearchCombobox'; import { toast } from 'react-toastify'; import { Button } from 'reactstrap'; @@ -18,6 +18,7 @@ interface IProps { // Search for existing equipment then send selection back to parent const SearchEquipment = (props: IProps) => { + const inputId = useId(); const [equipment, setEquipment] = useState([]); const [isSearchLoading, setIsSearchLoading] = useState(false); const context = useContext(Context); @@ -25,10 +26,10 @@ const SearchEquipment = (props: IProps) => { const renderSelectEquipment = () => { return (
- +
{ + const keySearchId = useId(); const assignment = props.selectedKeySerial && props.selectedKeySerial.keySerialAssignment; const [date, setDate] = useState( @@ -209,8 +210,9 @@ const AssignKeySerial = (props: IProps) => {
{!keySerial.key && (
- + { + const formId = useId(); const [error, setError] = useState(''); const [selectedKeyInfo, setSelectedKeyInfo] = useState( props.selectedKeyInfo @@ -68,8 +69,8 @@ const AssociateSpace = (props: IProps) => { return
{`${selectedSpace.roomNumber} ${selectedSpace.bldgName}`}
; } return
- - + +
; }; @@ -78,8 +79,8 @@ const AssociateSpace = (props: IProps) => { return
{`${selectedKeyInfo.key.name} - ${selectedKeyInfo.key.code}`}
; } return
- - + +
; }; diff --git a/Keas.Mvc/ClientApp/src/components/Keys/KeyContainer.test.tsx b/Keas.Mvc/ClientApp/src/components/Keys/KeyContainer.test.tsx index 9504d0168..24231a2fe 100644 --- a/Keas.Mvc/ClientApp/src/components/Keys/KeyContainer.test.tsx +++ b/Keas.Mvc/ClientApp/src/components/Keys/KeyContainer.test.tsx @@ -66,7 +66,7 @@ describe('Key Container', () => { }); const headerRecord = container.querySelector('.table-row').textContent; - expect(headerRecord).toBe(' Key NameKey CodeSerials SpacesActions'); + expect(headerRecord).toBe('DetailsKey NameKey CodeSerials (In Use / Total)SpacesActions'); }); it('Shows Add Button', async () => { diff --git a/Keas.Mvc/ClientApp/src/components/Keys/KeyEditValues.tsx b/Keas.Mvc/ClientApp/src/components/Keys/KeyEditValues.tsx index 3f2304016..dee335b06 100644 --- a/Keas.Mvc/ClientApp/src/components/Keys/KeyEditValues.tsx +++ b/Keas.Mvc/ClientApp/src/components/Keys/KeyEditValues.tsx @@ -1,6 +1,6 @@ import { AssetSummary } from '../Shared/AssetSummary'; import * as React from 'react'; -import { useState } from 'react'; +import { useId, useState } from 'react'; import { FormFeedback, FormGroup, Input, Label } from 'reactstrap'; import { IKey } from '../../models/Keys'; import { IValidationError } from '../../models/Shared'; @@ -15,6 +15,7 @@ interface IProps { } const KeyEditValues = (props: IProps) => { + const formId = useId(); const [name, setName] = useState(props.selectedKey.name); const [code, setCode] = useState(props.selectedKey.code); const [tags, setTags] = useState(props.selectedKey.tags); @@ -73,8 +74,9 @@ const KeyEditValues = (props: IProps) => { return (
- + { - + { - + { - + {error && error.path === 'tags' && error.message} diff --git a/Keas.Mvc/ClientApp/src/components/Keys/KeyList.tsx b/Keas.Mvc/ClientApp/src/components/Keys/KeyList.tsx index 2bf2cd602..565917cf6 100644 --- a/Keas.Mvc/ClientApp/src/components/Keys/KeyList.tsx +++ b/Keas.Mvc/ClientApp/src/components/Keys/KeyList.tsx @@ -1,5 +1,3 @@ -import { InformationCircleIcon } from '@heroicons/react/24/outline'; -import { UncontrolledTooltip } from 'reactstrap'; import { IKey, IKeyInfo } from '../../models/Keys'; import KeyListItem from './KeyListItem'; @@ -41,15 +39,12 @@ const KeyList = (props: IProps) => {
+ Details Serial Name Assigned To
- diff --git a/Keas.Mvc/ClientApp/src/components/Keys/KeySerialContainer.test.tsx b/Keas.Mvc/ClientApp/src/components/Keys/KeySerialContainer.test.tsx index f7bee166d..99b85c219 100644 --- a/Keas.Mvc/ClientApp/src/components/Keys/KeySerialContainer.test.tsx +++ b/Keas.Mvc/ClientApp/src/components/Keys/KeySerialContainer.test.tsx @@ -68,7 +68,7 @@ describe('Key Serial Container', () => { const headerRecord = document.querySelector('.table-row').textContent; expect(headerRecord).toBe( - ' Key Code and SNStatusAssignmentExpirationActions' + 'DetailsKey Code and SNStatusAssignmentExpirationActions' ); }); diff --git a/Keas.Mvc/ClientApp/src/components/Keys/KeySerialEditValues.tsx b/Keas.Mvc/ClientApp/src/components/Keys/KeySerialEditValues.tsx index e4a00bf3d..bc519320e 100644 --- a/Keas.Mvc/ClientApp/src/components/Keys/KeySerialEditValues.tsx +++ b/Keas.Mvc/ClientApp/src/components/Keys/KeySerialEditValues.tsx @@ -21,6 +21,7 @@ interface IProps { } const KeySerialEditValues = (props: IProps) => { + const formId = React.useId(); const { keySerial, error } = props; const numberValue = keySerial ? keySerial.number : ''; @@ -92,8 +93,9 @@ const KeySerialEditValues = (props: IProps) => {
{props.keySerial.key.name ? props.keySerial.key.name : ''}
{props.keySerial.key.code}
- + { - + { - + { - + { .filter(Boolean)} onSelect={tags => props.changeProperty('tags', tags.join(','))} placeholder='Search for Tags' - id='searchTagsKeySerialEditValues' + id={`${formId}-tags`} inputProps={{ 'aria-label': 'Tags' }} isInvalid={error && error.path === 'tags'} /> diff --git a/Keas.Mvc/ClientApp/src/components/Keys/KeySerialList.tsx b/Keas.Mvc/ClientApp/src/components/Keys/KeySerialList.tsx index 9c2b9f86a..bc948494f 100644 --- a/Keas.Mvc/ClientApp/src/components/Keys/KeySerialList.tsx +++ b/Keas.Mvc/ClientApp/src/components/Keys/KeySerialList.tsx @@ -39,7 +39,7 @@ const KeySerialList = (props: IProps) => {
+ Details Key Name Key Code Serials{' '} - - - In Use / Total - + (In Use / Total) Actions
- diff --git a/Keas.Mvc/ClientApp/src/components/Keys/KeySerialTable.tsx b/Keas.Mvc/ClientApp/src/components/Keys/KeySerialTable.tsx index b8272691b..48aac3b29 100644 --- a/Keas.Mvc/ClientApp/src/components/Keys/KeySerialTable.tsx +++ b/Keas.Mvc/ClientApp/src/components/Keys/KeySerialTable.tsx @@ -59,7 +59,7 @@ const KeySerialTable = (props: IProps) => { onClick={() => props.showDetails(data.row.original)} /> ), - header: ' ' + header: 'Details' }, { header: 'Key Code and SN', diff --git a/Keas.Mvc/ClientApp/src/components/Keys/KeyTable.tsx b/Keas.Mvc/ClientApp/src/components/Keys/KeyTable.tsx index e765a6d37..ea4dfd96d 100644 --- a/Keas.Mvc/ClientApp/src/components/Keys/KeyTable.tsx +++ b/Keas.Mvc/ClientApp/src/components/Keys/KeyTable.tsx @@ -1,7 +1,5 @@ import { AssetDetailsLink } from '../Shared/AssetDetailsLink'; -import { InformationCircleIcon } from '@heroicons/react/24/outline'; import * as React from 'react'; -import { UncontrolledTooltip } from 'reactstrap'; import { IKey, IKeyInfo } from '../../models/Keys'; import { ReactTableUtil } from '../../util/tableUtil'; import ListActionsDropdown, { IAction } from '../ListActionsDropdown'; @@ -32,7 +30,7 @@ export default class KeyTable extends React.Component { onClick={() => this.props.showDetails(data.row.original.key)} /> ), - header: ' ' + header: 'Details' }, { header: 'Key Name', @@ -54,14 +52,7 @@ export default class KeyTable extends React.Component { header: _ => (
Serials{' '} - - - In Use / Total - + (In Use / Total)
), accessorFn: keyInfo => { diff --git a/Keas.Mvc/ClientApp/src/components/Keys/SearchKeySerials.tsx b/Keas.Mvc/ClientApp/src/components/Keys/SearchKeySerials.tsx index 4ad37d523..dfc528b05 100644 --- a/Keas.Mvc/ClientApp/src/components/Keys/SearchKeySerials.tsx +++ b/Keas.Mvc/ClientApp/src/components/Keys/SearchKeySerials.tsx @@ -1,6 +1,6 @@ import { DisplayField } from '../Shared/AssetSummary'; import { PlusIcon } from '@heroicons/react/24/outline'; -import { useContext, useState } from 'react'; +import { useContext, useId, useState } from 'react'; import { SearchCombobox, Highlighter } from '../Shared/SearchCombobox'; import { toast } from 'react-toastify'; import { Button } from 'reactstrap'; @@ -18,6 +18,7 @@ interface IProps { // Search for existing key then send selection back to parent const SearchKeySerials = (props: IProps) => { + const inputId = useId(); const [isSearchLoading, setIsSearchLoading] = useState(false); const [keySerials, setKeySerials] = useState([]); const context = useContext(Context); @@ -31,10 +32,10 @@ const SearchKeySerials = (props: IProps) => { const renderSelectKey = () => { return (
- +
void; onDeselect: () => void; @@ -14,6 +16,7 @@ interface IProps { // Search for existing key then send selection back to parent const SearchKeys = (props: IProps) => { + const inputId = useId(); const [isSearchLoading, setIsSearchLoading] = useState(false); const [keysInfo, setKeysInfo] = useState([]); const context = useContext(Context); @@ -92,7 +95,8 @@ const SearchKeys = (props: IProps) => { return ( { + const inputId = useId(); const context = useContext(Context); const [isSearchLoading, setIsSearchLoading] = useState(false); const [people, setPeople] = useState([]); @@ -33,9 +34,9 @@ const AssignPerson = (props: IProps) => { return (
- + { const headerRecord = container.querySelector('.table-row').textContent; expect(headerRecord).toBe( - ' NameEmailSupervisorKeysEquipmentAccessWorkstations' + 'DetailsNameEmailSupervisorKeysEquipmentAccessWorkstations' ); }); diff --git a/Keas.Mvc/ClientApp/src/components/People/PeopleTable.tsx b/Keas.Mvc/ClientApp/src/components/People/PeopleTable.tsx index ab91a5b66..3de9c5a04 100644 --- a/Keas.Mvc/ClientApp/src/components/People/PeopleTable.tsx +++ b/Keas.Mvc/ClientApp/src/components/People/PeopleTable.tsx @@ -28,7 +28,7 @@ const PeopleTable = (props: IProps) => { onClick={() => props.showDetails(data.row.original)} /> ), - header: ' ' + header: 'Details' }, { header: 'Name', diff --git a/Keas.Mvc/ClientApp/src/components/Shared/DropdownScrolling.test.tsx b/Keas.Mvc/ClientApp/src/components/Shared/DropdownScrolling.test.tsx index f2666a84b..051c07acb 100644 --- a/Keas.Mvc/ClientApp/src/components/Shared/DropdownScrolling.test.tsx +++ b/Keas.Mvc/ClientApp/src/components/Shared/DropdownScrolling.test.tsx @@ -136,8 +136,8 @@ describe.each(dropdowns)('$name scrolling', ({ renderDropdown }) => { it('closes the previous selector when another selector is opened', () => { render(<> - - + + ); const first = screen.getByRole('combobox', { name: 'First tags' }); const second = screen.getByRole('combobox', { name: 'Second tags' }); diff --git a/Keas.Mvc/ClientApp/src/components/Shared/Filtering.tsx b/Keas.Mvc/ClientApp/src/components/Shared/Filtering.tsx index f787c90fa..df2d107c9 100644 --- a/Keas.Mvc/ClientApp/src/components/Shared/Filtering.tsx +++ b/Keas.Mvc/ClientApp/src/components/Shared/Filtering.tsx @@ -24,7 +24,7 @@ export const ColumnFilterHeaders = ({ {headerGroups.map(group => (
{group.headers.map(header => ( - ))} ))} diff --git a/Keas.Mvc/ClientApp/src/components/Shared/ReadOnlyAssetValues.test.tsx b/Keas.Mvc/ClientApp/src/components/Shared/ReadOnlyAssetValues.test.tsx index fd8079169..54bd2a8b7 100644 --- a/Keas.Mvc/ClientApp/src/components/Shared/ReadOnlyAssetValues.test.tsx +++ b/Keas.Mvc/ClientApp/src/components/Shared/ReadOnlyAssetValues.test.tsx @@ -1,7 +1,15 @@ import { cleanup, fireEvent, render, screen } from '@testing-library/react'; import { afterEach, expect, it, vi } from 'vitest'; +import AccessEditValues from '../Access/AccessEditValues'; +import EquipmentEditValues from '../Equipment/EquipmentEditValues'; +import KeyEditValues from '../Keys/KeyEditValues'; import KeySerialEditValues from '../Keys/KeySerialEditValues'; +import WorkstationEditValues from '../Workstations/WorkstationEditValues'; +import { fakeAccesses } from '../specs/mockData/Access'; +import { fakeEquipment } from '../specs/mockData/Equipment'; +import { fakeKeys } from '../specs/mockData/Key'; import { fakeKeySerials } from '../specs/mockData/KeySerial'; +import { fakeWorkstations } from '../specs/mockData/Workstation'; afterEach(cleanup); @@ -20,3 +28,62 @@ it('displays immutable key values as text while keeping serial edits functional' fireEvent.change(numberInput, { target: { value: 'NEW-123' } }); expect(change).toHaveBeenCalledWith('number', 'NEW-123'); }); + +it.each([ + { + name: 'access', + element: , + labels: ['Name', 'Notes', 'Tags'] + }, + { + name: 'key', + element: , + labels: ['Name', 'Code', 'Notes', 'Tags'] + }, + { + name: 'key serial', + element: , + labels: ['Key Serial Number', 'Status', 'Notes', 'Tags'] + }, + { + name: 'workstation', + element: , + labels: ['Name', 'Room', 'Notes', 'Tags'] + } +])('associates every $name edit field with its visible label', ({ element, labels }) => { + render(element); + labels.forEach(label => { + expect(screen.getByLabelText(label, { exact: true })).toHaveAccessibleName(label); + }); +}); + +it('names equipment fields and documentation links', () => { + render(); + [ + 'Name', 'Type', 'Serial Number / Identifier', 'Protection Level', + 'Availability Level', 'Make', 'Model', 'Managed System ID', 'Notes', 'Tags', 'Room' + ].forEach(label => { + expect(screen.getByLabelText(label, { exact: true })).toHaveAccessibleName(label); + }); + expect(screen.getByRole('link', { name: 'About protection levels' })).toHaveAttribute('href'); + expect(screen.getByRole('link', { name: 'About availability levels' })).toHaveAttribute('href'); + expect(screen.getByRole('link', { name: 'About equipment attributes' })).toHaveAttribute('href'); +}); + +it('keeps labels associated with their own controls when two key editors are mounted', () => { + render(<> + + + ); + ['Name', 'Code', 'Notes', 'Tags'].forEach(label => { + const controls = screen.getAllByLabelText(label, { exact: true }); + expect(controls).toHaveLength(2); + expect(controls[0].id).not.toBe(controls[1].id); + controls.forEach(control => expect(control).toHaveAccessibleName(label)); + }); +}); diff --git a/Keas.Mvc/ClientApp/src/components/Shared/SearchAsyncOptions.test.tsx b/Keas.Mvc/ClientApp/src/components/Shared/SearchAsyncOptions.test.tsx index d7899c3e5..b6cb8771b 100644 --- a/Keas.Mvc/ClientApp/src/components/Shared/SearchAsyncOptions.test.tsx +++ b/Keas.Mvc/ClientApp/src/components/Shared/SearchAsyncOptions.test.tsx @@ -1,4 +1,13 @@ import { fireEvent, render, screen, waitFor } from '@testing-library/react'; +import { MemoryRouter } from 'react-router'; +import { Context } from '../../Context'; +import SearchAccess from '../Access/SearchAccess'; +import SearchEquipment from '../Equipment/SearchEquipment'; +import SearchKeys from '../Keys/SearchKeys'; +import SearchKeySerials from '../Keys/SearchKeySerials'; +import AssignPerson from '../People/AssignPerson'; +import SearchSpaces from '../Spaces/SearchSpaces'; +import SearchWorkstations from '../Workstations/SearchWorkstations'; import SearchAsyncOptions from './SearchAsyncOptions'; it('searches asynchronously, selects a server result and hides the menu on outside focus after rerender', async () => { @@ -6,6 +15,7 @@ it('searches asynchronously, selects a server result and hides the menu on outsi const onChange = vi.fn(); const props = { id: 'people-search', + inputProps: { 'aria-label': 'Find person' }, isLoading: false, minLength: 2, placeholder: 'Find person', @@ -17,7 +27,7 @@ it('searches asynchronously, selects a server result and hides the menu on outsi options: [] }; const { rerender } = render(); - const input = screen.getByRole('combobox'); + const input = screen.getByRole('combobox', { name: 'Find person' }); fireEvent.focus(input); fireEvent.change(input, { target: { value: 'Sa' } }); await waitFor(() => expect(onSearch).toHaveBeenCalledWith('Sa')); @@ -43,6 +53,7 @@ it('preserves a default selection and permits a new value', async () => { render( { expect.objectContaining({ name: 'New person', customOption: true }) ]); }); + +it.each([ + { name: 'Supervisor', element: }, + { name: 'Pick an access to assign', element: }, + { name: 'Pick an equipment to assign', element: }, + { name: 'Pick a key serial to assign', element: }, + { name: 'Pick a workstation to assign', element: } +])('uses the visible label "$name" for an assignment search', ({ name, element }) => { + render( + {element} + ); + const input = screen.getByRole('combobox', { name }); + expect(screen.getByLabelText(name)).toBe(input); +}); + +it('uses external labels for Room and key searches without overriding them', () => { + render(<> + + + + + ); + expect(screen.getByRole('combobox', { name: 'Room' })).toBe(screen.getByLabelText('Room')); + expect(screen.getByRole('combobox', { name: 'Pick a key to associate' })).toBe(screen.getByLabelText('Pick a key to associate')); +}); + +it('keeps standalone searches named and generates unique IDs for repeated instances', () => { + render(<> + + + + + ); + expect(screen.getAllByRole('combobox', { name: 'Search for space' })).toHaveLength(2); + expect(screen.getAllByRole('combobox', { name: 'Search for key by name or by serial number' })).toHaveLength(2); + const inputs = screen.getAllByRole('combobox'); + expect(new Set(inputs.map(input => input.id)).size).toBe(inputs.length); +}); diff --git a/Keas.Mvc/ClientApp/src/components/Shared/SearchAsyncOptions.tsx b/Keas.Mvc/ClientApp/src/components/Shared/SearchAsyncOptions.tsx index 9473017c2..48a521d7c 100644 --- a/Keas.Mvc/ClientApp/src/components/Shared/SearchAsyncOptions.tsx +++ b/Keas.Mvc/ClientApp/src/components/Shared/SearchAsyncOptions.tsx @@ -1,7 +1,9 @@ +import { InputHTMLAttributes } from 'react'; import { SearchCombobox } from './SearchCombobox'; interface IProps { id: string; + inputProps?: InputHTMLAttributes; isLoading: boolean; minLength: number; placeholder: string; @@ -23,6 +25,7 @@ const SearchAsyncOptions = (props: IProps) => { return ( { + it('keeps the visible label as its name before and after keyboard selection', () => { + const change = vi.fn(); + render(<> + + + ); + const input = screen.getByRole('combobox', { name: 'Room' }); + expect(screen.getByLabelText('Room')).toBe(input); + fireEvent.change(input, { target: { value: '101' } }); + fireEvent.keyDown(input, { key: 'ArrowDown' }); + fireEvent.keyDown(input, { key: 'Enter' }); + expect(change).toHaveBeenCalledWith(['Room 101']); + expect(input).toHaveValue('Room 101'); + expect(input).toHaveAccessibleName('Room'); + }); + + it('preserves an explicit accessible name for a standalone search', () => { + render(); + expect(screen.getByRole('combobox', { name: 'Find a person' })).toBeInTheDocument(); + }); + it('filters suggestions and selects with the keyboard', () => { const change = vi.fn(); render(); diff --git a/Keas.Mvc/ClientApp/src/components/Shared/SearchCombobox.tsx b/Keas.Mvc/ClientApp/src/components/Shared/SearchCombobox.tsx index ad8423aa4..4999121cc 100644 --- a/Keas.Mvc/ClientApp/src/components/Shared/SearchCombobox.tsx +++ b/Keas.Mvc/ClientApp/src/components/Shared/SearchCombobox.tsx @@ -23,6 +23,7 @@ interface Props { newSelectionPrefix?: string; filterBy?: (option: any) => boolean; highlightOnlyResult?: boolean; + // Use an associated label, or supply aria-label/aria-labelledby here. inputProps?: React.InputHTMLAttributes; renderMenuItemChildren?: (option: any, props: { text: string }, index: number) => React.ReactNode; } @@ -108,7 +109,7 @@ export const SearchCombobox = (props: Props) => { ))} = 0 ? `${props.id}-option-${activeIndex}` : undefined} aria-invalid={props.isInvalid || undefined} aria-busy={loading || undefined} diff --git a/Keas.Mvc/ClientApp/src/components/Shared/TableCompatibility.test.tsx b/Keas.Mvc/ClientApp/src/components/Shared/TableCompatibility.test.tsx index 7b1df2956..1e2a5364d 100644 --- a/Keas.Mvc/ClientApp/src/components/Shared/TableCompatibility.test.tsx +++ b/Keas.Mvc/ClientApp/src/components/Shared/TableCompatibility.test.tsx @@ -11,6 +11,7 @@ import AccessAssignmentTable from '../Access/AccessAssignmentTable'; import EquipmentTable from '../Equipment/EquipmentTable'; import KeySerialTable from '../Keys/KeySerialTable'; import KeyTable from '../Keys/KeyTable'; +import KeyList from '../Keys/KeyList'; import PeopleTable from '../People/PeopleTable'; import SpacesTable from '../Spaces/SpacesTable'; import { fakeAccesses } from '../specs/mockData/Access'; @@ -160,6 +161,38 @@ const shownIds = ( return details.mock.calls.map(([record]) => record.id); }; +it.each(tableCases)( + 'names every column in $name without exposing filter cells as extra headers', + ({ element }) => { + const { container } = render(element(['Alpha'], vi.fn())); + expect(screen.getByRole('columnheader', { name: 'Details' })) + .toBeInTheDocument(); + screen.getAllByRole('columnheader').forEach(header => { + expect(header).toHaveAccessibleName(); + }); + const filters = container.querySelector('.asset-table-filters'); + expect(within(filters as HTMLElement).queryAllByRole('columnheader')) + .toHaveLength(0); + } +); + +it.each([ + ['keys', 'Serials (In Use / Total)'], + ['spaces', 'Workstations (In Use / Total)'] +])('exposes the %s count explanation without hover', (name, heading) => { + render(tableCases.find(table => table.name === name).element(['Alpha'], vi.fn())); + expect(screen.getByRole('columnheader', { name: heading })).toBeVisible(); + expect(screen.getByText('(In Use / Total)')).toBeVisible(); +}); + +it('exposes the nested key list count explanation without hover', () => { + render(); + expect(screen.getByRole('columnheader', { name: 'Serials (In Use / Total)' })) + .toBeVisible(); + expect(screen.getByText('(In Use / Total)')).toBeVisible(); + expect(screen.getByRole('columnheader', { name: 'Details' })).toBeInTheDocument(); +}); + it.each(tableCases)( 'preserves case, natural numbers and ties in $name', ({ header, element }) => { diff --git a/Keas.Mvc/ClientApp/src/components/Shared/TableFilters.test.tsx b/Keas.Mvc/ClientApp/src/components/Shared/TableFilters.test.tsx index 5f22c43b6..b4d41a12b 100644 --- a/Keas.Mvc/ClientApp/src/components/Shared/TableFilters.test.tsx +++ b/Keas.Mvc/ClientApp/src/components/Shared/TableFilters.test.tsx @@ -8,9 +8,11 @@ import { import EquipmentTable from '../Equipment/EquipmentTable'; import AccessTable from '../Access/AccessTable'; import KeySerialTable from '../Keys/KeySerialTable'; +import SpacesTable from '../Spaces/SpacesTable'; import { fakeEquipment } from '../specs/mockData/Equipment'; import { fakeAccesses } from '../specs/mockData/Access'; import { fakeKeySerials } from '../specs/mockData/KeySerial'; +import { fakeSpaces } from '../specs/mockData/Space'; afterEach(() => { cleanup(); @@ -23,6 +25,23 @@ const names = (container: HTMLElement) => row => row.children[2].textContent ); +it('names the workstation filter and preserves its assigned-space behavior', () => { + const { container } = render( + + ); + const filter = screen.getByRole('combobox', { name: 'Filter workstations' }); + fireEvent.change(filter, { target: { value: 'assigned' } }); + expect(container.querySelectorAll('tbody tr')).toHaveLength(1); + expect(container.querySelector('tbody')).toHaveTextContent('Temporary Building 200'); + fireEvent.change(filter, { target: { value: 'all' } }); + expect(container.querySelectorAll('tbody tr')).toHaveLength(2); +}); + it.each([ ['expired', ['Past', 'Now']], ['unexpired', ['Later', 'Three weeks', 'Six weeks']], diff --git a/Keas.Mvc/ClientApp/src/components/Spaces/SearchSpaces.tsx b/Keas.Mvc/ClientApp/src/components/Spaces/SearchSpaces.tsx index 8418cfcae..5fbc63a30 100644 --- a/Keas.Mvc/ClientApp/src/components/Spaces/SearchSpaces.tsx +++ b/Keas.Mvc/ClientApp/src/components/Spaces/SearchSpaces.tsx @@ -1,10 +1,12 @@ -import { useContext, useState } from 'react'; +import { useContext, useId, useState } from 'react'; import { SearchCombobox, Highlighter } from '../Shared/SearchCombobox'; import { toast } from 'react-toastify'; import { Context } from '../../Context'; import { ISpace } from '../../models/Spaces'; interface IProps { + // Supply an id when associating a visible label outside this component. + id?: string; onSelect: (space: ISpace) => void; defaultSpace?: ISpace; isRequired?: boolean; @@ -13,6 +15,7 @@ interface IProps { // TODO: need a way to clear out selected space // Assign a space via search lookup, unless a space is already provided const SearchSpaces = (props: IProps) => { + const inputId = useId(); const [isSearchLoading, setIsSearchLoading] = useState(false); const [spaces, setSpaces] = useState([]); const context = useContext(Context); @@ -72,7 +75,8 @@ const SearchSpaces = (props: IProps) => { return ( { }); const headerRecord = container.querySelector('.table-row').textContent; - expect(headerRecord).toBe(' RoomRoom NameKeysEquipmentWorkstations '); + expect(headerRecord).toBe('DetailsRoomRoom NameKeysEquipmentWorkstations (In Use / Total)'); }); it('Shows spaces list', async () => { diff --git a/Keas.Mvc/ClientApp/src/components/Spaces/SpacesList.tsx b/Keas.Mvc/ClientApp/src/components/Spaces/SpacesList.tsx index ef284bd1d..0cccfcca5 100644 --- a/Keas.Mvc/ClientApp/src/components/Spaces/SpacesList.tsx +++ b/Keas.Mvc/ClientApp/src/components/Spaces/SpacesList.tsx @@ -33,7 +33,7 @@ const SpacesList = (props: IProps) => {
+ Details Key Code Serial Number Status
+
({ ) : null}
- +
- diff --git a/Keas.Mvc/ClientApp/src/components/Spaces/SpacesTable.tsx b/Keas.Mvc/ClientApp/src/components/Spaces/SpacesTable.tsx index ee5a8ba77..6db56f22a 100644 --- a/Keas.Mvc/ClientApp/src/components/Spaces/SpacesTable.tsx +++ b/Keas.Mvc/ClientApp/src/components/Spaces/SpacesTable.tsx @@ -1,7 +1,5 @@ import { AssetDetailsLink } from '../Shared/AssetDetailsLink'; -import { InformationCircleIcon } from '@heroicons/react/24/outline'; import * as React from 'react'; -import { UncontrolledTooltip } from 'reactstrap'; import { ISpace, ISpaceInfo } from '../../models/Spaces'; import { ReactTableUtil } from '../../util/tableUtil'; import { ReactTable } from '../Shared/ReactTable'; @@ -24,6 +22,7 @@ const SpaceWorkstationColumnFilter = ({ column }) => { return ( Name + props.changeProperty('name', e.target.value)} invalid={error && error.path === 'name'} /> @@ -61,14 +63,15 @@ const WorkstationEditValues = (props: IProps) => { ? `${props.selectedWorkstation.space.roomNumber} ${props.selectedWorkstation.space.bldgName}` : null} ) : ( - - props.changeProperty('space', space)} + + props.changeProperty('space', space)} defaultSpace={props.space || props.selectedWorkstation.space} isRequired /> )} - + { - + { } onSelect={e => props.changeProperty('tags', e.join(','))} placeholder='Search for Tags' - id='searchTagsWorkstationEditValues' + id={`${formId}-tags`} /> {error && error.path === 'tags' && error.message} diff --git a/Keas.Mvc/ClientApp/src/components/Workstations/WorkstationList.tsx b/Keas.Mvc/ClientApp/src/components/Workstations/WorkstationList.tsx index 5be805560..4cb3dae6d 100644 --- a/Keas.Mvc/ClientApp/src/components/Workstations/WorkstationList.tsx +++ b/Keas.Mvc/ClientApp/src/components/Workstations/WorkstationList.tsx @@ -38,7 +38,7 @@ const WorkstationList = (props: IProps) => {
+ Details Room Room Name Actions
- diff --git a/Keas.Mvc/ClientApp/src/styles/asset-tables.css b/Keas.Mvc/ClientApp/src/styles/asset-tables.css index bbde89131..7b05c18f2 100644 --- a/Keas.Mvc/ClientApp/src/styles/asset-tables.css +++ b/Keas.Mvc/ClientApp/src/styles/asset-tables.css @@ -31,7 +31,7 @@ white-space: nowrap; } - .asset-table .table .asset-table-filters th { + .asset-table .table .asset-table-filters td { padding-top: 0; padding-bottom: 0.75rem; } diff --git a/Keas.Mvc/Views/Admin/Index.cshtml b/Keas.Mvc/Views/Admin/Index.cshtml index 9007a958e..21f988277 100644 --- a/Keas.Mvc/Views/Admin/Index.cshtml +++ b/Keas.Mvc/Views/Admin/Index.cshtml @@ -26,7 +26,7 @@ } @@ -48,7 +48,7 @@ { - + } diff --git a/Keas.Mvc/Views/DocumentSettings/Index.cshtml b/Keas.Mvc/Views/DocumentSettings/Index.cshtml index 4226b5a5d..1c230b2f7 100644 --- a/Keas.Mvc/Views/DocumentSettings/Index.cshtml +++ b/Keas.Mvc/Views/DocumentSettings/Index.cshtml @@ -60,7 +60,7 @@ } diff --git a/Keas.Mvc/Views/Group/IncompleteDocumentsReport.cshtml b/Keas.Mvc/Views/Group/IncompleteDocumentsReport.cshtml index b1730e231..8d86481f5 100644 --- a/Keas.Mvc/Views/Group/IncompleteDocumentsReport.cshtml +++ b/Keas.Mvc/Views/Group/IncompleteDocumentsReport.cshtml @@ -37,7 +37,7 @@ } - + diff --git a/Keas.Mvc/Views/Group/PeopleLeavingWithAssets.cshtml b/Keas.Mvc/Views/Group/PeopleLeavingWithAssets.cshtml index c7f2e8670..d8e29b1c8 100644 --- a/Keas.Mvc/Views/Group/PeopleLeavingWithAssets.cshtml +++ b/Keas.Mvc/Views/Group/PeopleLeavingWithAssets.cshtml @@ -70,7 +70,7 @@ - + diff --git a/Keas.Mvc/Views/Report/ActionsByAdmins.cshtml b/Keas.Mvc/Views/Report/ActionsByAdmins.cshtml index a8274ab17..24f15d4c1 100644 --- a/Keas.Mvc/Views/Report/ActionsByAdmins.cshtml +++ b/Keas.Mvc/Views/Report/ActionsByAdmins.cshtml @@ -61,7 +61,7 @@ - + diff --git a/Keas.Mvc/Views/Report/InactiveSpaces.cshtml b/Keas.Mvc/Views/Report/InactiveSpaces.cshtml index dc874adc3..4d59ebf4a 100644 --- a/Keas.Mvc/Views/Report/InactiveSpaces.cshtml +++ b/Keas.Mvc/Views/Report/InactiveSpaces.cshtml @@ -35,7 +35,7 @@ - + diff --git a/Keas.Mvc/Views/Report/PeopleInTeam.cshtml b/Keas.Mvc/Views/Report/PeopleInTeam.cshtml index 2c2fc98b1..3f041523d 100644 --- a/Keas.Mvc/Views/Report/PeopleInTeam.cshtml +++ b/Keas.Mvc/Views/Report/PeopleInTeam.cshtml @@ -96,7 +96,7 @@ - + diff --git a/Keas.Mvc/Views/Report/PeopleLeavingWithAssets.cshtml b/Keas.Mvc/Views/Report/PeopleLeavingWithAssets.cshtml index 80268e276..9e025faae 100644 --- a/Keas.Mvc/Views/Report/PeopleLeavingWithAssets.cshtml +++ b/Keas.Mvc/Views/Report/PeopleLeavingWithAssets.cshtml @@ -69,7 +69,7 @@ - + diff --git a/Keas.Mvc/Views/Report/PeopleWithIncompleteDocuments.cshtml b/Keas.Mvc/Views/Report/PeopleWithIncompleteDocuments.cshtml index 1c045dcd6..ec8be8ee4 100644 --- a/Keas.Mvc/Views/Report/PeopleWithIncompleteDocuments.cshtml +++ b/Keas.Mvc/Views/Report/PeopleWithIncompleteDocuments.cshtml @@ -35,7 +35,7 @@ { } - + diff --git a/Keas.Mvc/Views/Report/PersonEquipmentHistoryReport.cshtml b/Keas.Mvc/Views/Report/PersonEquipmentHistoryReport.cshtml index 994e9c0dd..bf816ef62 100644 --- a/Keas.Mvc/Views/Report/PersonEquipmentHistoryReport.cshtml +++ b/Keas.Mvc/Views/Report/PersonEquipmentHistoryReport.cshtml @@ -25,7 +25,7 @@ - + diff --git a/Keas.Mvc/Views/Report/SupervisorDirectReports.cshtml b/Keas.Mvc/Views/Report/SupervisorDirectReports.cshtml index 4f26eb3a3..371c2d9e2 100644 --- a/Keas.Mvc/Views/Report/SupervisorDirectReports.cshtml +++ b/Keas.Mvc/Views/Report/SupervisorDirectReports.cshtml @@ -34,7 +34,7 @@ - + diff --git a/docs/accessibility-level-a-issue.md b/docs/accessibility-level-a-issue.md new file mode 100644 index 000000000..58600d9b5 --- /dev/null +++ b/docs/accessibility-level-a-issue.md @@ -0,0 +1,138 @@ +# Fix WCAG Level A accessibility issues in forms, tables, and help controls + +## Summary + +An accessibility review identified missing accessible names, visible-label mismatches, blank table headers, and keyboard-inaccessible help content in Peaks. These issues affect screen-reader, speech-input, and keyboard users and correspond to WCAG Level A requirements. + +The findings below come from source review and selected rendered-component checks, not a live Siteimprove scan. Siteimprove rule references identify likely checks; actual detection depends on which pages and interaction states the scanner reaches. + +## Findings + +### 1. Form controls lack accessible names + +**WCAG:** 4.1.2 Name, Role, Value (A). Disconnected visible labels also affect 1.3.1 Info and Relationships (A). + +**Siteimprove:** [SIA-R8: Form fields have an accessible name](https://alfa.siteimprove.com/rules/sia-r8). + +Rendered-component checks confirmed ten editable controls with empty accessible names: + +| File | Controls | Lines at time of review | +| --- | --- | --- | +| `Keas.Mvc/ClientApp/src/components/Access/AccessEditValues.tsx` | Name; Notes | 49; 69 | +| `Keas.Mvc/ClientApp/src/components/Keys/KeyEditValues.tsx` | Name; Code; Notes | 77; 94; 112 | +| `Keas.Mvc/ClientApp/src/components/Keys/KeySerialEditValues.tsx` | Key Serial Number; Status; Notes | 96; 111; 127 | +| `Keas.Mvc/ClientApp/src/components/Workstations/WorkstationEditValues.tsx` | Notes | 71 | +| `Keas.Mvc/ClientApp/src/components/Equipment/EquipmentEditValues.tsx` | Managed System ID | 300 | + +The workstation filter ` +``` + +Check the rendered tables after DataTables/React initialization, including populated rows. + +### 5. Managed-system search loses its button name while loading + +**WCAG:** 4.1.2 Name, Role, Value (A). + +**Siteimprove:** [SIA-R12: Buttons have an accessible name](https://alfa.siteimprove.com/rules/sia-r12). + +`Keas.Mvc/ClientApp/src/components/Equipment/EquipmentManagedSystemSearchId.tsx:149` replaces “Search!” with whitespace and a screen-reader-hidden spinner while a request is pending. The resulting button has no accessible name. + +**Expected fix:** Retain a meaningful name such as “Searching…” while displaying the spinner. Verify the pending-request state explicitly; a normal page-load scan may miss it. + +### 6. Count-explanation tooltips have no keyboard trigger + +**WCAG:** [2.1.1 Keyboard (A)](https://www.w3.org/WAI/WCAG22/Understanding/keyboard.html). + +The “In Use / Total” explanations are attached to unfocusable, screen-reader-hidden SVG icons in: + +- `Keas.Mvc/ClientApp/src/components/Keys/KeyTable.tsx:57` +- `Keas.Mvc/ClientApp/src/components/Keys/KeyList.tsx:49` +- `Keas.Mvc/ClientApp/src/components/Spaces/SpacesTable.tsx:118` + +Keyboard users cannot trigger these tooltips to learn what the two counts mean. + +**Expected fix:** Make the explanation visible or provide a named, keyboard-focusable help control with an accessible description. Verify keyboard and screen-reader behavior manually; do not rely on automated scanning alone. + +## Acceptance criteria + +- [ ] Every identified form control and filter has a meaningful accessible name associated with its visible label where present. +- [ ] All three equipment help links have descriptive accessible names. +- [ ] The admin links, account-selection button, Room searches, and Supervisor search expose names containing their visible labels. +- [ ] Affected action/Details columns have meaningful headers in the rendered tables. +- [ ] The managed-system search button retains an accessible name while loading. +- [ ] Keyboard and screen-reader users can access the count explanations in Keys and Spaces. +- [ ] Recheck affected pages and open dialogs with Siteimprove or an equivalent accessibility checker; explicitly exercise the loading state. +- [ ] Add focused regression coverage for the corrected accessible names and label associations, and run the existing accessibility-related tests. + +## Review validation + +- Actual React components were rendered in memory using existing dependencies, and accessible-name calculations confirmed the ten unnamed edit controls, three unnamed help links, and Room/Supervisor name mismatches. +- Seven existing targeted test files passed, totaling 31 tests. These passing tests did not catch the identified gaps. +- No application source files were changed during the review. +- File line numbers are reference points from the review and may move as fixes are applied. From 9c54e06977c308f37afacb3df680bf44baefea04 Mon Sep 17 00:00:00 2001 From: Cal Date: Tue, 17 Nov 2026 10:15:21 -0800 Subject: [PATCH 2/4] doc removal and table width change --- .../components/Equipment/EquipmentTable.tsx | 1 + .../src/components/Shared/ReactTable.tsx | 6 +- .../ClientApp/src/styles/asset-tables.css | 22 +++ docs/accessibility-level-a-issue.md | 138 ------------------ 4 files changed, 27 insertions(+), 140 deletions(-) delete mode 100644 docs/accessibility-level-a-issue.md diff --git a/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentTable.tsx b/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentTable.tsx index 299f7c2a9..26e4c1feb 100644 --- a/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentTable.tsx +++ b/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentTable.tsx @@ -116,6 +116,7 @@ const EquipmentTable = (props: IProps) => { return ( ({ columns, data, - initialState + initialState, + tableClassName = '' }: { columns: PeaksColumn[]; data: T[]; initialState?: PeaksInitialState; + tableClassName?: string; }) => { const table = useTable({ features: peaksFeatures, @@ -53,7 +55,7 @@ export const ReactTable = ({ return (
-
+ Details Name Space Assigned To@item.Slug
@item.Id@item.NameView groupView group
@item.AccountName@item.AccountId@item.ApiBasePath
- +
OtherTeamActions
Team Actions
Description Actions
Equipment Count Key Count WorkStation CountActions
User Email Actions
@Html.DisplayNameFor(model => model.Slug) Actions
OtherActions
Action Actor DescriptionActions
Name Actions
Actions
+
{headerGroups.map(headerGroup => ( diff --git a/Keas.Mvc/ClientApp/src/styles/asset-tables.css b/Keas.Mvc/ClientApp/src/styles/asset-tables.css index 7b05c18f2..e07afe246 100644 --- a/Keas.Mvc/ClientApp/src/styles/asset-tables.css +++ b/Keas.Mvc/ClientApp/src/styles/asset-tables.css @@ -36,6 +36,28 @@ padding-bottom: 0.75rem; } + /* Keep filtering and pagination from resizing equipment columns. */ + .asset-table .equipment-table { + table-layout: fixed; + min-width: 64rem; + } + + .asset-table .equipment-table th:first-child { + width: 7rem; + } + + .asset-table .equipment-table th:nth-child(5) { + width: 14rem; + } + + .asset-table .equipment-table th:last-child { + width: 9rem; + } + + .asset-table .equipment-table tbody td { + overflow-wrap: anywhere; + } + .asset-table .table tbody tr:nth-child(odd) { background: color-mix( in oklab, diff --git a/docs/accessibility-level-a-issue.md b/docs/accessibility-level-a-issue.md deleted file mode 100644 index 58600d9b5..000000000 --- a/docs/accessibility-level-a-issue.md +++ /dev/null @@ -1,138 +0,0 @@ -# Fix WCAG Level A accessibility issues in forms, tables, and help controls - -## Summary - -An accessibility review identified missing accessible names, visible-label mismatches, blank table headers, and keyboard-inaccessible help content in Peaks. These issues affect screen-reader, speech-input, and keyboard users and correspond to WCAG Level A requirements. - -The findings below come from source review and selected rendered-component checks, not a live Siteimprove scan. Siteimprove rule references identify likely checks; actual detection depends on which pages and interaction states the scanner reaches. - -## Findings - -### 1. Form controls lack accessible names - -**WCAG:** 4.1.2 Name, Role, Value (A). Disconnected visible labels also affect 1.3.1 Info and Relationships (A). - -**Siteimprove:** [SIA-R8: Form fields have an accessible name](https://alfa.siteimprove.com/rules/sia-r8). - -Rendered-component checks confirmed ten editable controls with empty accessible names: - -| File | Controls | Lines at time of review | -| --- | --- | --- | -| `Keas.Mvc/ClientApp/src/components/Access/AccessEditValues.tsx` | Name; Notes | 49; 69 | -| `Keas.Mvc/ClientApp/src/components/Keys/KeyEditValues.tsx` | Name; Code; Notes | 77; 94; 112 | -| `Keas.Mvc/ClientApp/src/components/Keys/KeySerialEditValues.tsx` | Key Serial Number; Status; Notes | 96; 111; 127 | -| `Keas.Mvc/ClientApp/src/components/Workstations/WorkstationEditValues.tsx` | Notes | 71 | -| `Keas.Mvc/ClientApp/src/components/Equipment/EquipmentEditValues.tsx` | Managed System ID | 300 | - -The workstation filter ` -``` - -Check the rendered tables after DataTables/React initialization, including populated rows. - -### 5. Managed-system search loses its button name while loading - -**WCAG:** 4.1.2 Name, Role, Value (A). - -**Siteimprove:** [SIA-R12: Buttons have an accessible name](https://alfa.siteimprove.com/rules/sia-r12). - -`Keas.Mvc/ClientApp/src/components/Equipment/EquipmentManagedSystemSearchId.tsx:149` replaces “Search!” with whitespace and a screen-reader-hidden spinner while a request is pending. The resulting button has no accessible name. - -**Expected fix:** Retain a meaningful name such as “Searching…” while displaying the spinner. Verify the pending-request state explicitly; a normal page-load scan may miss it. - -### 6. Count-explanation tooltips have no keyboard trigger - -**WCAG:** [2.1.1 Keyboard (A)](https://www.w3.org/WAI/WCAG22/Understanding/keyboard.html). - -The “In Use / Total” explanations are attached to unfocusable, screen-reader-hidden SVG icons in: - -- `Keas.Mvc/ClientApp/src/components/Keys/KeyTable.tsx:57` -- `Keas.Mvc/ClientApp/src/components/Keys/KeyList.tsx:49` -- `Keas.Mvc/ClientApp/src/components/Spaces/SpacesTable.tsx:118` - -Keyboard users cannot trigger these tooltips to learn what the two counts mean. - -**Expected fix:** Make the explanation visible or provide a named, keyboard-focusable help control with an accessible description. Verify keyboard and screen-reader behavior manually; do not rely on automated scanning alone. - -## Acceptance criteria - -- [ ] Every identified form control and filter has a meaningful accessible name associated with its visible label where present. -- [ ] All three equipment help links have descriptive accessible names. -- [ ] The admin links, account-selection button, Room searches, and Supervisor search expose names containing their visible labels. -- [ ] Affected action/Details columns have meaningful headers in the rendered tables. -- [ ] The managed-system search button retains an accessible name while loading. -- [ ] Keyboard and screen-reader users can access the count explanations in Keys and Spaces. -- [ ] Recheck affected pages and open dialogs with Siteimprove or an equivalent accessibility checker; explicitly exercise the loading state. -- [ ] Add focused regression coverage for the corrected accessible names and label associations, and run the existing accessibility-related tests. - -## Review validation - -- Actual React components were rendered in memory using existing dependencies, and accessible-name calculations confirmed the ten unnamed edit controls, three unnamed help links, and Room/Supervisor name mismatches. -- Seven existing targeted test files passed, totaling 31 tests. These passing tests did not catch the identified gaps. -- No application source files were changed during the review. -- File line numbers are reference points from the review and may move as fixes are applied. From b9477f1ded9495bf8d78d9a4e66851a5c4c2bd63 Mon Sep 17 00:00:00 2001 From: Cal Date: Tue, 17 Nov 2026 10:53:43 -0800 Subject: [PATCH 3/4] more table A changes --- .../src/components/Access/AccessList.tsx | 2 +- .../Equipment/EquipmentContainer.test.tsx | 10 +++ .../components/Equipment/EquipmentList.tsx | 2 +- .../EquipmentManagedSystemSearchId.tsx | 7 ++ .../src/components/History/HistoryList.tsx | 3 - .../ClientApp/src/components/Keys/KeyList.tsx | 2 +- .../src/components/Keys/KeySerialList.tsx | 2 +- .../src/components/People/BioContainer.tsx | 9 ++- .../PersonDetailsAccessibility.test.tsx | 68 +++++++++++++++++++ .../components/Shared/SearchCombobox.test.tsx | 15 ++++ .../src/components/Shared/SearchCombobox.tsx | 7 +- .../src/components/Spaces/SpacesList.tsx | 2 +- .../Workstations/WorkstationList.tsx | 2 +- 13 files changed, 116 insertions(+), 15 deletions(-) create mode 100644 Keas.Mvc/ClientApp/src/components/People/PersonDetailsAccessibility.test.tsx diff --git a/Keas.Mvc/ClientApp/src/components/Access/AccessList.tsx b/Keas.Mvc/ClientApp/src/components/Access/AccessList.tsx index fe5930331..d13508855 100644 --- a/Keas.Mvc/ClientApp/src/components/Access/AccessList.tsx +++ b/Keas.Mvc/ClientApp/src/components/Access/AccessList.tsx @@ -15,7 +15,7 @@ const AccessAssignmentList = (props: IProps) => { const access = !props.accessAssignments || props.accessAssignments.length < 1 ? ( - + ) : ( props.accessAssignments.map(x => ( diff --git a/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentContainer.test.tsx b/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentContainer.test.tsx index cf3fdf735..9d240da9e 100644 --- a/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentContainer.test.tsx +++ b/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentContainer.test.tsx @@ -36,6 +36,8 @@ describe('Managed-system search accessibility', () => { fireEvent.click(screen.getByRole('button', { name: 'Look Up' })); const dialog = await screen.findByRole('dialog', { name: 'Search by Computer Property' }); const property = within(dialog).getByRole('textbox', { name: 'Computer Property' }); + const status = within(dialog).getByRole('status'); + expect(status).toBeEmptyDOMElement(); expect(within(dialog).getByLabelText('Computer Property')).toBe(property); fireEvent.change(property, { target: { value: 'Research' } }); fireEvent.click(within(dialog).getByRole('button', { name: 'Search!' })); @@ -43,6 +45,7 @@ describe('Managed-system search accessibility', () => { const pending = within(dialog).getByRole('button', { name: 'Searching…' }); expect(pending).toBeDisabled(); expect(pending).toHaveAttribute('aria-busy', 'true'); + expect(status).toHaveTextContent('Searching…'); expect(fetch).toHaveBeenCalledExactlyOnceWith('/api/team/equipment/GetComputersBySearch?value=Research'); await act(async () => resolveSearch({ result: [{ @@ -51,8 +54,15 @@ describe('Managed-system search accessibility', () => { hardware_u_device_name: 'LAB-01' }] })); expect(within(dialog).getByRole('button', { name: 'Search!' })).toBeEnabled(); + expect(status).toHaveTextContent('1 computer found.'); fireEvent.click(within(dialog).getByRole('button', { name: 'Research laptop (LAB-01)' })); expect(select).toHaveBeenCalledExactlyOnceWith('systemManagementId', '123'); + + fireEvent.click(within(dialog).getByRole('button', { name: 'Search!' })); + expect(status).toHaveTextContent('Searching…'); + await act(async () => resolveSearch({ result: [] })); + expect(within(dialog).getByRole('status')).toBe(status); + expect(status).toHaveTextContent('No results found for the search term.'); }); }); diff --git a/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentList.tsx b/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentList.tsx index 94d9abc97..028cc0fb0 100644 --- a/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentList.tsx +++ b/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentList.tsx @@ -15,7 +15,7 @@ const EquipmentList = (props: IProps) => { const equipment = !props.equipment || props.equipment.length < 1 ? ( - + ) : ( props.equipment.map(x => ( diff --git a/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentManagedSystemSearchId.tsx b/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentManagedSystemSearchId.tsx index 344b87cd3..155f8c99b 100644 --- a/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentManagedSystemSearchId.tsx +++ b/Keas.Mvc/ClientApp/src/components/Equipment/EquipmentManagedSystemSearchId.tsx @@ -69,6 +69,13 @@ const EquipmentManagedSystemSearchId = (props: IProps) => { Computer property is required +
+ {isSearching ? 'Searching…' : isFetched + ? !isValidSearch ? 'No data to present.' + : listOfComputers?.length ? `${listOfComputers.length} ${listOfComputers.length === 1 ? 'computer' : 'computers'} found.` + : 'No results found for the search term.' + : ''} +
{renderNameTable()} ); diff --git a/Keas.Mvc/ClientApp/src/components/History/HistoryList.tsx b/Keas.Mvc/ClientApp/src/components/History/HistoryList.tsx index ea84c399b..6fe6a3dd7 100644 --- a/Keas.Mvc/ClientApp/src/components/History/HistoryList.tsx +++ b/Keas.Mvc/ClientApp/src/components/History/HistoryList.tsx @@ -13,9 +13,6 @@ const HistoryList = (props: IProps) => { return (
Actions
No Accesses FoundNo Accesses Found
No Equipment FoundNo Equipment Found
- - - {histories}
diff --git a/Keas.Mvc/ClientApp/src/components/Keys/KeyList.tsx b/Keas.Mvc/ClientApp/src/components/Keys/KeyList.tsx index 565917cf6..44445ead7 100644 --- a/Keas.Mvc/ClientApp/src/components/Keys/KeyList.tsx +++ b/Keas.Mvc/ClientApp/src/components/Keys/KeyList.tsx @@ -29,7 +29,7 @@ const KeyList = (props: IProps) => { const keys = !keysInfo || keysInfo.length < 1 ? ( - No Keys Found + No Keys Found ) : ( keysInfo.map(renderItem) diff --git a/Keas.Mvc/ClientApp/src/components/Keys/KeySerialList.tsx b/Keas.Mvc/ClientApp/src/components/Keys/KeySerialList.tsx index bc948494f..3b710ef66 100644 --- a/Keas.Mvc/ClientApp/src/components/Keys/KeySerialList.tsx +++ b/Keas.Mvc/ClientApp/src/components/Keys/KeySerialList.tsx @@ -29,7 +29,7 @@ const KeySerialList = (props: IProps) => { const serials = !keySerials || keySerials.length < 1 ? ( - No Key Serials Found + No Key Serials Found ) : ( keySerials.map(renderItem) diff --git a/Keas.Mvc/ClientApp/src/components/People/BioContainer.tsx b/Keas.Mvc/ClientApp/src/components/People/BioContainer.tsx index 30dd386ba..3b46b6496 100644 --- a/Keas.Mvc/ClientApp/src/components/People/BioContainer.tsx +++ b/Keas.Mvc/ClientApp/src/components/People/BioContainer.tsx @@ -31,8 +31,7 @@ const BioContainer = ({ person }: IProps) => { person.userId || person.homePhone || person.teamPhone || - person.supervisor || - person.isSupervisor; + person.supervisor; const tags = Array.from( new Set( (person.tags || '') @@ -69,10 +68,10 @@ const BioContainer = ({ person }: IProps) => { )} - {hasContact && ( + {(hasContact || person.isSupervisor) && (

Contact details

-
+ {hasContact &&
{person.email && ( { {person.supervisor && ( {person.supervisor.name} )} -
+
} {person.isSupervisor && ( ], + ['equipment', ], + ['key serials', ], + ['keys', ], + ['spaces', ], + ['workstations', ] +])('covers every %s column with the empty-state data cell', (_name, element) => { + render(element); + expect(screen.getByRole('cell')).toHaveAttribute( + 'colspan', String(screen.getAllByRole('columnheader').length) + ); +}); + +const context = { + fetch: vi.fn(), + permissions: [], + team: { id: 1, name: 'Team', slug: 'team' }, + tags: [] +}; + +it('keeps history content without an empty table header container', () => { + const { container } = render( + + + + ); + expect(screen.getByRole('cell', { name: 'Assigned equipment' })).toBeVisible(); + expect(container.querySelector('thead')).toBeNull(); +}); + +it('keeps the direct-reports link without an empty contact description list', () => { + const person = { + ...fakeEquipment[0].assignment.person, + email: null, userId: null, homePhone: null, teamPhone: null, + supervisor: null, isSupervisor: true + }; + const { container, rerender } = render( + + ); + expect(screen.getByRole('link', { name: 'View direct reports' })).toHaveAttribute( + 'href', `/team/Report/SupervisorDirectReports/?personId=${person.id}` + ); + expect(container.querySelector('dl')).toBeNull(); + rerender( + + + + ); + expect(container.querySelector('dl dt')).toHaveTextContent('Email'); + expect(screen.getByRole('link', { name: 'person@example.com' })).toBeVisible(); +}); diff --git a/Keas.Mvc/ClientApp/src/components/Shared/SearchCombobox.test.tsx b/Keas.Mvc/ClientApp/src/components/Shared/SearchCombobox.test.tsx index bdc87f250..a0f55be27 100644 --- a/Keas.Mvc/ClientApp/src/components/Shared/SearchCombobox.test.tsx +++ b/Keas.Mvc/ClientApp/src/components/Shared/SearchCombobox.test.tsx @@ -6,6 +6,20 @@ import { SearchCombobox } from './SearchCombobox'; afterEach(cleanup); describe('DaisyUI search combobox', () => { + it('updates a persistent live region for matches, no matches, and dismissal', () => { + render(); + const status = screen.getByRole('status'); + const input = screen.getByRole('combobox'); + expect(status).toBeEmptyDOMElement(); + fireEvent.change(input, { target: { value: 'lap' } }); + expect(status).toHaveTextContent('1 option available.'); + fireEvent.change(input, { target: { value: 'missing' } }); + expect(screen.getByRole('status')).toBe(status); + expect(status).toHaveTextContent('No matches found'); + fireEvent.keyDown(input, { key: 'Escape' }); + expect(status).toBeEmptyDOMElement(); + }); + it('keeps the visible label as its name before and after keyboard selection', () => { const change = vi.fn(); render(<> @@ -107,6 +121,7 @@ describe('DaisyUI search combobox', () => { expect(screen.queryByRole('listbox')).toBeNull(); fireEvent.change(input, { target: { value: 'Ali' } }); fireEvent.change(input, { target: { value: 'Alice' } }); + expect(screen.getByRole('status')).toHaveTextContent('Searching…'); await waitFor(() => expect(search).toHaveBeenCalledWith('Alice')); expect(search).toHaveBeenCalledTimes(1); view.rerender( true} />); diff --git a/Keas.Mvc/ClientApp/src/components/Shared/SearchCombobox.tsx b/Keas.Mvc/ClientApp/src/components/Shared/SearchCombobox.tsx index 4999121cc..1a1caf693 100644 --- a/Keas.Mvc/ClientApp/src/components/Shared/SearchCombobox.tsx +++ b/Keas.Mvc/ClientApp/src/components/Shared/SearchCombobox.tsx @@ -121,7 +121,7 @@ export const SearchCombobox = (props: Props) => { setQuery(event.target.value); setOpen(true); setActive(-1); }} onKeyDown={handleKeyDown} /> - {loading && } + {loading &&