1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-15 17:50:48 +02:00

refactor: misc a11y improvements (#899)

* refactor: add missing input IDs to make labels work

* refactor: fix heading orders

* refactor: add missing environment switch label

* refactor: make scrollable area focusable

* refactor: use <li>s inside the events <ul>

* refactor: remove duplicate ID attribute
This commit is contained in:
olav 2022-04-22 09:54:01 +02:00 committed by GitHub
parent fd8e1c196c
commit 96d2c924b4
9 changed files with 17 additions and 9 deletions

View File

@ -49,9 +49,7 @@ const SelectMenu: React.FC<ISelectMenuProps> = ({
return ( return (
<FormControl variant="outlined" size="small" classes={classes}> <FormControl variant="outlined" size="small" classes={classes}>
<InputLabel htmlFor={id} id={id}> <InputLabel htmlFor={id}>{label}</InputLabel>
{label}
</InputLabel>
<Select <Select
name={name} name={name}
disabled={disabled} disabled={disabled}

View File

@ -79,6 +79,7 @@ const FeatureForm: React.FC<IFeatureToggleForm> = ({
disabled={mode === 'Edit'} disabled={mode === 'Edit'}
className={styles.input} className={styles.input}
label="Name" label="Name"
id="feature-toggle-name"
error={Boolean(errors.name)} error={Boolean(errors.name)}
errorText={errors.name} errorText={errors.name}
onFocus={() => clearErrors()} onFocus={() => clearErrors()}
@ -141,6 +142,7 @@ const FeatureForm: React.FC<IFeatureToggleForm> = ({
variant="subtitle1" variant="subtitle1"
className={styles.roleSubtitle} className={styles.roleSubtitle}
data-loading data-loading
component="h2"
> >
Impression Data Impression Data
</Typography> </Typography>

View File

@ -132,6 +132,7 @@ const FeatureToggleListNewItem = ({
environmentId={env.name} environmentId={env.name}
projectId={projectId} projectId={projectId}
permission={UPDATE_FEATURE_ENVIRONMENT} permission={UPDATE_FEATURE_ENVIRONMENT}
inputProps={{ 'aria-label': env.name }}
ref={ref} ref={ref}
onClick={() => { onClick={() => {
handleToggle(env); handleToggle(env);

View File

@ -85,6 +85,7 @@ const FlexibleStrategy = ({
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
}} }}
component="h2"
> >
Stickiness Stickiness
<Tooltip title="Stickiness defines what parameter should be used to ensure that your users get consistency in features. By default unleash will use the first value present in the context in the order of userId, sessionId and random."> <Tooltip title="Stickiness defines what parameter should be used to ensure that your users get consistency in features. By default unleash will use the first value present in the context in the order of userId, sessionId and random.">
@ -119,6 +120,7 @@ const FlexibleStrategy = ({
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
}} }}
component="h2"
> >
GroupId GroupId
<Tooltip title="GroupId is used to ensure that different toggles will hash differently for the same user. The groupId defaults to feature toggle name, but you can override it to correlate rollout of multiple feature toggles."> <Tooltip title="GroupId is used to ensure that different toggles will hash differently for the same user. The groupId defaults to feature toggle name, but you can override it to correlate rollout of multiple feature toggles.">
@ -133,6 +135,7 @@ const FlexibleStrategy = ({
</Typography> </Typography>
<Input <Input
label="groupId" label="groupId"
id="groupId-input"
value={groupId || ''} value={groupId || ''}
disabled={!editable} disabled={!editable}
onChange={e => onUpdate('groupId')(e, e.target.value)} onChange={e => onUpdate('groupId')(e, e.target.value)}

View File

@ -90,6 +90,7 @@ const RolloutSlider = ({
id="discrete-slider-always" id="discrete-slider-always"
variant="subtitle2" variant="subtitle2"
gutterBottom gutterBottom
component="h2"
> >
{name} {name}
</Typography> </Typography>

View File

@ -67,7 +67,9 @@ const StrategyInputList = ({
return ( return (
<div> <div>
<Typography variant="subtitle2">List of {name}</Typography> <Typography variant="subtitle2" component="h2">
List of {name}
</Typography>
<div <div
style={{ style={{
display: 'flex', display: 'flex',
@ -93,6 +95,7 @@ const StrategyInputList = ({
name={`input_field`} name={`input_field`}
variant="outlined" variant="outlined"
label="Add items" label="Add items"
id="input-add-items"
value={input} value={input}
size="small" size="small"
placeholder="" placeholder=""

View File

@ -94,7 +94,7 @@ const EventDiff = ({ entry }) => {
} }
return ( return (
<pre style={{ overflowX: 'auto', overflowY: 'hidden' }}> <pre style={{ overflowX: 'auto', overflowY: 'hidden' }} tabIndex={0}>
<code className="smalltext man"> <code className="smalltext man">
{changes.length === 0 ? '(no changes)' : changes} {changes.length === 0 ? '(no changes)' : changes}
</code> </code>

View File

@ -13,11 +13,11 @@ const EventJson = ({ entry }) => {
const prettyPrinted = JSON.stringify(localEventData, null, 2); const prettyPrinted = JSON.stringify(localEventData, null, 2);
return ( return (
<div className={styles.historyItem}> <li className={styles.historyItem}>
<div> <div>
<code className="JSON smalltext man">{prettyPrinted}</code> <code className="JSON smalltext man">{prettyPrinted}</code>
</div> </div>
</div> </li>
); );
}; };

View File

@ -30,12 +30,12 @@ const EventLog = ({
let entries; let entries;
const renderListItemCards = entry => ( const renderListItemCards = entry => (
<div key={entry.id} className={styles.eventEntry}> <li key={entry.id} className={styles.eventEntry}>
<EventCard <EventCard
entry={entry} entry={entry}
timeFormatted={formatFulldateTime(entry.createdAt)} timeFormatted={formatFulldateTime(entry.createdAt)}
/> />
</div> </li>
); );
if (eventSettings.showData) { if (eventSettings.showData) {