diff --git a/res/css/views/rooms/wysiwyg_composer/components/_FormattingButtons.pcss b/res/css/views/rooms/wysiwyg_composer/components/_FormattingButtons.pcss index 76026ff9381..342a40c6065 100644 --- a/res/css/views/rooms/wysiwyg_composer/components/_FormattingButtons.pcss +++ b/res/css/views/rooms/wysiwyg_composer/components/_FormattingButtons.pcss @@ -53,7 +53,9 @@ limitations under the License. height: var(--size); border-radius: 5px; } + } + .mx_FormattingButtons_Button_hover { &:hover { &::after { background: rgba($secondary-content, 0.1); diff --git a/src/components/views/rooms/wysiwyg_composer/components/FormattingButtons.tsx b/src/components/views/rooms/wysiwyg_composer/components/FormattingButtons.tsx index 32b132cc6cd..c9408c8f0f3 100644 --- a/src/components/views/rooms/wysiwyg_composer/components/FormattingButtons.tsx +++ b/src/components/views/rooms/wysiwyg_composer/components/FormattingButtons.tsx @@ -48,7 +48,10 @@ function Button({ label, keyCombo, onClick, isActive, className }: ButtonProps) onClick={onClick} title={label} className={ - classNames('mx_FormattingButtons_Button', className, { 'mx_FormattingButtons_active': isActive })} + classNames('mx_FormattingButtons_Button', className, { + 'mx_FormattingButtons_active': isActive, + 'mx_FormattingButtons_Button_hover': !isActive, + })} tooltip={keyCombo && } alignment={Alignment.Top} />; diff --git a/test/components/views/rooms/wysiwyg_composer/components/FormattingButtons-test.tsx b/test/components/views/rooms/wysiwyg_composer/components/FormattingButtons-test.tsx index 2447e2f0760..f97b2c614f0 100644 --- a/test/components/views/rooms/wysiwyg_composer/components/FormattingButtons-test.tsx +++ b/test/components/views/rooms/wysiwyg_composer/components/FormattingButtons-test.tsx @@ -75,4 +75,20 @@ describe('FormattingButtons', () => { // Then expect(await screen.findByText('Bold')).toBeTruthy(); }); + + it('Should not have hover style when active', async () => { + // When + const user = userEvent.setup(); + render(); + await user.hover(screen.getByLabelText('Bold')); + + // Then + expect(screen.getByLabelText('Bold')).not.toHaveClass('mx_FormattingButtons_Button_hover'); + + // When + await user.hover(screen.getByLabelText('Underline')); + + // Then + expect(screen.getByLabelText('Underline')).toHaveClass('mx_FormattingButtons_Button_hover'); + }); });