Skip to content

Commit

Permalink
refactor: tidy shoeReaderCount bool logic
Browse files Browse the repository at this point in the history
  • Loading branch information
RODO94 committed Oct 9, 2024
1 parent db2b0a6 commit 507342e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions editor.planx.uk/src/ui/shared/CharacterCounter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const CharacterCounter: React.FC<Props> = ({ limit, count }) => {
setShowReaderCount(false);
}
updateCharacterCount(currentCharacterCount);
}, [currentCharacterCount, updateCharacterCount]);
}, [currentCharacterCount, updateCharacterCount, count, screenReaderCount]);

const characterLimitText = showCharacterLimitError
? `You have ${Math.abs(currentCharacterCount)} characters too many`
Expand Down Expand Up @@ -59,7 +59,7 @@ export const CharacterCounter: React.FC<Props> = ({ limit, count }) => {
{characterLimitText}
</Typography>
<Typography aria-live="polite" aria-atomic="true" sx={visuallyHidden}>
{showReaderCount ? screenReaderCountText : ""}
{showReaderCount && screenReaderCountText}
</Typography>
</>
);
Expand Down

0 comments on commit 507342e

Please sign in to comment.