mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-14 01:16:17 +02:00
Fix(1-3553): fix focus styles and tab navigation for segments + constraints (#9655)
Fixes a few small focus styling and tab navigation issues for the new segments + constraints. Before: The segment acc header was tabbable even though you can't do anything with it (by mouse or by keyboard)  The focus color would stay even when you're focusing stuff inside the accordion  Constraint items have focus styles that exceed the accordion borders, causing a weird squaring effect:  After: The segment acc header isn't reachable by tab anymore. The segment acc header doesn't change its background color on elements inside getting focus:  The constraint item has rounded corners for focus styles too:  
This commit is contained in:
parent
bba85dc9b0
commit
645b005f29
@ -112,14 +112,12 @@ export const ConstraintItemHeader: FC<ConstraintItemHeaderProps> = ({
|
|||||||
) : null}
|
) : null}
|
||||||
</StyledOperatorGroup>
|
</StyledOperatorGroup>
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<ValuesList
|
||||||
<ValuesList
|
values={items}
|
||||||
values={items}
|
onSetTruncated={onSetTruncated}
|
||||||
onSetTruncated={onSetTruncated}
|
tooltips={tooltips}
|
||||||
tooltips={tooltips}
|
/>
|
||||||
/>
|
{viewMore}
|
||||||
{viewMore}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</StyledConstraintContainer>
|
</StyledConstraintContainer>
|
||||||
</StrategyEvaluationItem>
|
</StrategyEvaluationItem>
|
||||||
|
@ -35,6 +35,7 @@ const StyledAccordion = styled(Accordion)(({ theme }) => ({
|
|||||||
'&:before': {
|
'&:before': {
|
||||||
opacity: '0',
|
opacity: '0',
|
||||||
},
|
},
|
||||||
|
overflow: 'hidden',
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const StyledAccordionSummary = styled(AccordionSummary)(({ theme }) => ({
|
const StyledAccordionSummary = styled(AccordionSummary)(({ theme }) => ({
|
||||||
|
@ -20,7 +20,7 @@ const StyledHeaderMetaInfo = styled('div')(({ theme }) => ({
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const StyledExpandItem = styled('div')(({ theme }) => ({
|
const StyledExpandItem = styled('p')(({ theme }) => ({
|
||||||
color: theme.palette.secondary.main,
|
color: theme.palette.secondary.main,
|
||||||
margin: theme.spacing(0.25, 0, 0, 0.75),
|
margin: theme.spacing(0.25, 0, 0, 0.75),
|
||||||
fontSize: theme.fontSizes.smallerBody,
|
fontSize: theme.fontSizes.smallerBody,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { useMemo, useState, type FC } from 'react';
|
import { useId, useMemo, useState, type FC } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import type { ISegment } from 'interfaces/segment';
|
import type { ISegment } from 'interfaces/segment';
|
||||||
import {
|
import {
|
||||||
@ -41,6 +41,9 @@ const StyledAccordion = styled(Accordion)(() => ({
|
|||||||
const StyledAccordionSummary = styled(AccordionSummary)(({ theme }) => ({
|
const StyledAccordionSummary = styled(AccordionSummary)(({ theme }) => ({
|
||||||
fontSize: theme.typography.body2.fontSize,
|
fontSize: theme.typography.body2.fontSize,
|
||||||
minHeight: 'unset',
|
minHeight: 'unset',
|
||||||
|
':focus-within': {
|
||||||
|
backgroundColor: 'inherit',
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const StyledAccordionDetails = styled(AccordionDetails)(({ theme }) => ({
|
const StyledAccordionDetails = styled(AccordionDetails)(({ theme }) => ({
|
||||||
@ -77,6 +80,7 @@ export const SegmentItem: FC<SegmentItemProps> = ({
|
|||||||
constraintList,
|
constraintList,
|
||||||
}) => {
|
}) => {
|
||||||
const [isOpen, setIsOpen] = useState(isExpanded || false);
|
const [isOpen, setIsOpen] = useState(isExpanded || false);
|
||||||
|
const segmentDetailsId = useId();
|
||||||
|
|
||||||
const constraints = useMemo(() => {
|
const constraints = useMemo(() => {
|
||||||
if (constraintList) {
|
if (constraintList) {
|
||||||
@ -110,7 +114,11 @@ export const SegmentItem: FC<SegmentItemProps> = ({
|
|||||||
disableGutters
|
disableGutters
|
||||||
TransitionProps={{ mountOnEnter: true, unmountOnExit: true }}
|
TransitionProps={{ mountOnEnter: true, unmountOnExit: true }}
|
||||||
>
|
>
|
||||||
<StyledAccordionSummary id={`segment-accordion-${segment.id}`}>
|
<StyledAccordionSummary
|
||||||
|
id={`segment-accordion-${segment.id}`}
|
||||||
|
tabIndex={-1}
|
||||||
|
aria-controls={segmentDetailsId}
|
||||||
|
>
|
||||||
<StrategyEvaluationItem type='Segment'>
|
<StrategyEvaluationItem type='Segment'>
|
||||||
<StyledLink to={`/segments/edit/${segment.id}`}>
|
<StyledLink to={`/segments/edit/${segment.id}`}>
|
||||||
{segment.name}
|
{segment.name}
|
||||||
@ -120,6 +128,7 @@ export const SegmentItem: FC<SegmentItemProps> = ({
|
|||||||
{!isExpanded ? (
|
{!isExpanded ? (
|
||||||
<StyledActionsContainer>
|
<StyledActionsContainer>
|
||||||
<StyledButton
|
<StyledButton
|
||||||
|
aria-controls={segmentDetailsId}
|
||||||
size='small'
|
size='small'
|
||||||
variant='outlined'
|
variant='outlined'
|
||||||
onClick={() => setIsOpen((value) => !value)}
|
onClick={() => setIsOpen((value) => !value)}
|
||||||
|
Loading…
Reference in New Issue
Block a user