diff --git a/e2e-tests/cypress/tests/integration/channels/settings/display/theme/code_theme_colors_spec.js b/e2e-tests/cypress/tests/integration/channels/settings/display/theme/code_theme_colors_spec.js index 45f09a9967..c2b0bbfd78 100644 --- a/e2e-tests/cypress/tests/integration/channels/settings/display/theme/code_theme_colors_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/settings/display/theme/code_theme_colors_spec.js @@ -35,10 +35,10 @@ describe('Settings > Display > Theme > Custom Theme Colors', () => { cy.get('#customThemes').check().should('be.checked'); // # Open Center Channel Styles section - cy.get('#centerChannelStyles').click({force: true}).wait(TIMEOUTS.ONE_HUNDRED_MILLIS); + cy.get('#centerChannelStylesAccordion').click({force: true}).wait(TIMEOUTS.ONE_HUNDRED_MILLIS); // # Select custom code theme - cy.get('#codeThemeSelect').should('be.visible').scrollIntoView().select(theme.name); + cy.get('#codeThemeSelect').scrollIntoView().should('be.visible').select(theme.name); // * Verify that the setting changes in the background? verifyLastPostStyle(theme); diff --git a/webapp/channels/src/components/user_settings/display/user_settings_theme/custom_theme_chooser/__snapshots__/custom_theme_chooser.test.tsx.snap b/webapp/channels/src/components/user_settings/display/user_settings_theme/custom_theme_chooser/__snapshots__/custom_theme_chooser.test.tsx.snap index 4eed442c91..482056efe1 100644 --- a/webapp/channels/src/components/user_settings/display/user_settings_theme/custom_theme_chooser/__snapshots__/custom_theme_chooser.test.tsx.snap +++ b/webapp/channels/src/components/user_settings/display/user_settings_theme/custom_theme_chooser/__snapshots__/custom_theme_chooser.test.tsx.snap @@ -2,33 +2,45 @@ exports[`components/user_settings/display/CustomThemeChooser should match, init 1`] = `
-
- -
- - -
-
+
+ + +
+ +
-
- -
- - -
-
+
+ + +
+ +
-
- -
- - -
-
+
+ + +
+ +
{ textareaRef: RefObject; - sidebarStylesHeaderRef: RefObject; - centerChannelStylesHeaderRef: RefObject; - linkAndButtonStylesHeaderRef: RefObject; + sidebarStylesHeaderRef: RefObject; + centerChannelStylesHeaderRef: RefObject; + linkAndButtonStylesHeaderRef: RefObject; sidebarStylesRef: RefObject; centerChannelStylesRef: RefObject; linkAndButtonStylesRef: RefObject; @@ -160,7 +160,7 @@ export class CustomThemeChooser extends React.PureComponent { [settingId]: color, }; - // For backwards compatability + // For backwards compatibility if (settingId === 'mentionBg') { newTheme.mentionBj = color; } @@ -220,24 +220,33 @@ export class CustomThemeChooser extends React.PureComponent { this.textareaRef.current?.setSelectionRange(0, this.state.copyTheme.length); }; - toggleSidebarStyles = (e: MouseEvent) => { + toggleSidebarStyles = (e: MouseEvent) => { e.preventDefault(); this.sidebarStylesHeaderRef.current?.classList.toggle('open'); + + const isAccordionOpen = this.sidebarStylesHeaderRef.current?.classList.contains('open'); + this.sidebarStylesHeaderRef.current?.setAttribute('aria-expanded', `${isAccordionOpen}`); this.toggleSection(this.sidebarStylesRef.current); }; - toggleCenterChannelStyles = (e: MouseEvent) => { + toggleCenterChannelStyles = (e: MouseEvent) => { e.preventDefault(); this.centerChannelStylesHeaderRef.current?.classList.toggle('open'); + + const isAccordionOpen = this.centerChannelStylesHeaderRef.current?.classList.contains('open'); + this.centerChannelStylesHeaderRef.current?.setAttribute('aria-expanded', `${isAccordionOpen}`); this.toggleSection(this.centerChannelStylesRef.current); }; - toggleLinkAndButtonStyles = (e: MouseEvent) => { + toggleLinkAndButtonStyles = (e: MouseEvent) => { e.preventDefault(); this.linkAndButtonStylesHeaderRef.current?.classList.toggle('open'); + + const isAccordionOpen = this.linkAndButtonStylesHeaderRef.current?.classList.contains('open'); + this.linkAndButtonStylesHeaderRef.current?.setAttribute('aria-expanded', `${isAccordionOpen}`); this.toggleSection(this.linkAndButtonStylesRef.current); }; @@ -448,91 +457,118 @@ export class CustomThemeChooser extends React.PureComponent { ); return ( -
+
-
- -
- +
-
+
+ + +
+ +
{sidebarElements}
-
- -
- +
-
+
+ + +
+ +
{centerChannelElements}
-
- -
- +
-
+
+ + +
+ +
{linkAndButtonElements}
diff --git a/webapp/channels/src/components/user_settings/display/user_settings_theme/premade_theme_chooser/premade_theme_chooser.tsx b/webapp/channels/src/components/user_settings/display/user_settings_theme/premade_theme_chooser/premade_theme_chooser.tsx index 4bc77c3e4d..a01d83d44c 100644 --- a/webapp/channels/src/components/user_settings/display/user_settings_theme/premade_theme_chooser/premade_theme_chooser.tsx +++ b/webapp/channels/src/components/user_settings/display/user_settings_theme/premade_theme_chooser/premade_theme_chooser.tsx @@ -39,9 +39,9 @@ const PremadeThemeChooser = ({theme, updateTheme, allowedThemes = []}: Props) => className='col-xs-6 col-sm-3 premade-themes' key={'premade-theme-key' + k} > -
updateTheme(premadeTheme)} > -
+
, ); } } return ( -
+
{premadeThemes}
diff --git a/webapp/channels/src/components/user_settings/display/user_settings_theme/user_settings_theme.tsx b/webapp/channels/src/components/user_settings/display/user_settings_theme/user_settings_theme.tsx index c9a6226e58..d343671590 100644 --- a/webapp/channels/src/components/user_settings/display/user_settings_theme/user_settings_theme.tsx +++ b/webapp/channels/src/components/user_settings/display/user_settings_theme/user_settings_theme.tsx @@ -195,6 +195,7 @@ export default class ThemeSetting extends React.PureComponent { name='theme' checked={!displayCustom} onChange={this.updateType.bind(this, 'premade')} + aria-controls='premadeThemesSection' /> { ); } - inputs.push(premade); - if (this.props.allowCustomThemes) { inputs.push(
{ name='theme' checked={displayCustom} onChange={this.updateType.bind(this, 'custom')} + aria-controls='customThemesSection' /> {
, ); - inputs.push(custom); + inputs.push(premade, custom); inputs.push(
@@ -271,7 +271,19 @@ export default class ThemeSetting extends React.PureComponent { themeUI = ( + + + +
+ {inputs} +
+ + } submitExtra={allTeamsCheckbox} submit={this.submitTheme} disableEnterSubmit={true} diff --git a/webapp/channels/src/sass/routes/_settings.scss b/webapp/channels/src/sass/routes/_settings.scss index 835d07c914..c5f129a249 100644 --- a/webapp/channels/src/sass/routes/_settings.scss +++ b/webapp/channels/src/sass/routes/_settings.scss @@ -371,6 +371,11 @@ white-space: nowrap; } + .premadeThemeButton{ + border: none; + background: none; + } + label { width: 100%; } @@ -407,13 +412,22 @@ } .theme-elements__header { - padding: 1px 0 10px; border-bottom: 1px solid; margin: 10px 20px 0 0; cursor: pointer; font-size: functions.em(13.5px); font-weight: 600; + button { + display: flex; + width: 100%; + align-items: center; + justify-content: space-between; + padding: 10px 1px; + border: none; + background: none; + } + .fa-minus { display: none; }