Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
30 changes: 29 additions & 1 deletion ui/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -2254,10 +2254,38 @@ strong.metric-value-danger {
justify-content: space-between;
align-items: flex-start;
gap: 1rem;
position: sticky;
top: -1.25rem;
z-index: 1;
margin: -1.25rem -1.25rem 0;
padding: 0.9rem 1.25rem 0.85rem;
border-bottom: 1px solid var(--border-default);
background: linear-gradient(180deg, rgba(11, 23, 39, 0.985) 0%, rgba(7, 17, 31, 0.96) 100%);
box-shadow: 0 0.75rem 1rem rgba(0, 0, 0, 0.12);
}

.modal-header-title {
flex: 1 1 auto;
min-width: 0;
}

.modal-header h3 {
margin-top: 0.15rem;
margin: 0;
overflow-wrap: anywhere;
}

.modal-close-button {
flex: none;
display: inline-flex;
align-items: center;
justify-content: center;
width: 2.25rem;
min-width: 2.25rem;
min-height: 2.25rem;
padding: 0;
border-radius: 0.7rem;
font-size: 1.35rem;
line-height: 1;
}

.modal-summary-grid {
Expand Down
30 changes: 29 additions & 1 deletion ui/dist/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -2254,10 +2254,38 @@ strong.metric-value-danger {
justify-content: space-between;
align-items: flex-start;
gap: 1rem;
position: sticky;
top: -1.25rem;
z-index: 1;
margin: -1.25rem -1.25rem 0;
padding: 0.9rem 1.25rem 0.85rem;
border-bottom: 1px solid var(--border-default);
background: linear-gradient(180deg, rgba(11, 23, 39, 0.985) 0%, rgba(7, 17, 31, 0.96) 100%);
box-shadow: 0 0.75rem 1rem rgba(0, 0, 0, 0.12);
}

.modal-header-title {
flex: 1 1 auto;
min-width: 0;
}

.modal-header h3 {
margin-top: 0.15rem;
margin: 0;
overflow-wrap: anywhere;
}

.modal-close-button {
flex: none;
display: inline-flex;
align-items: center;
justify-content: center;
width: 2.25rem;
min-width: 2.25rem;
min-height: 2.25rem;
padding: 0;
border-radius: 0.7rem;
font-size: 1.35rem;
line-height: 1;
}

.modal-summary-grid {
Expand Down
6 changes: 3 additions & 3 deletions ui/ts/components/LiquidationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,11 @@ export function LiquidationModal({
<div className='modal-backdrop' role='presentation' onClick={closeLiquidationModal}>
<section ref={dialogRef} className='modal-panel' role='dialog' aria-modal='true' aria-labelledby='liquidation-modal-title' onClick={event => event.stopPropagation()}>
<div className='modal-header'>
<div>
<div className='modal-header-title'>
<h3 id='liquidation-modal-title'>{getLiquidationModalTitle(currentPoolOracleManagerDetails)}</h3>
</div>
<button ref={closeButtonRef} className='quiet' onClick={closeLiquidationModal}>
Close
<button ref={closeButtonRef} className='quiet modal-close-button' type='button' aria-label='Close' title='Close' onClick={closeLiquidationModal}>
×
</button>
</div>
{queuedLiquidationStatus === undefined ? null : queuedLiquidationStatus === 'queued' ? (
Expand Down
6 changes: 3 additions & 3 deletions ui/ts/components/OperationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ export function OperationModal({ children, description, isOpen, onClose, title }
<div className='modal-backdrop' role='presentation' onClick={onClose}>
<section ref={dialogRef} className='modal-panel operation-modal-panel' role='dialog' aria-modal='true' aria-labelledby='operation-modal-title' onClick={event => event.stopPropagation()}>
<div className='modal-header'>
<div>
<div className='modal-header-title'>
<h3 id='operation-modal-title'>{title}</h3>
</div>
<button ref={closeButtonRef} className='quiet' type='button' onClick={onClose}>
Close
<button ref={closeButtonRef} className='quiet modal-close-button' type='button' aria-label='Close' title='Close' onClick={onClose}>
×
</button>
</div>
{description === undefined ? undefined : <p className='detail'>{description}</p>}
Expand Down
2 changes: 1 addition & 1 deletion ui/ts/tests/liquidationModal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ describe('LiquidationModal', () => {
let renderedComponent = await renderModal()
cleanupRenderedComponent = renderedComponent.cleanup

const closeButton = within(document.body).getByText('Close') as HTMLButtonElement
const closeButton = within(document.body).getByRole('button', { name: 'Close' }) as HTMLButtonElement
const cancelButton = within(document.body).getByText('Cancel') as HTMLButtonElement
expect(document.activeElement).toBe(closeButton)

Expand Down
18 changes: 18 additions & 0 deletions ui/ts/tests/operationModal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@ describe('OperationModal', () => {
restoreDomEnvironment = undefined
})

test('exposes the dialog title and close control accessibly', async () => {
const container = document.createElement('div')
document.body.appendChild(container)

await act(() => {
render(<OperationModalHarness />, container)
})

const dialog = within(container).getByRole('dialog', { name: 'Edit amount' })
const closeButton = within(dialog).getByRole('button', { name: 'Close' })

expect(dialog).not.toBeNull()
expect(closeButton.textContent).toBe('×')

render(null, container)
container.remove()
})

test('keeps focus on the edited input while the modal rerenders', async () => {
const container = document.createElement('div')
document.body.appendChild(container)
Expand Down
Loading