Skip to content

ROX-27186: Delete conditional code for classic dark theme#13436

Merged
pedrottimark merged 3 commits intomasterfrom
ROX-27186-delete-isDarkMode
Dec 4, 2024
Merged

ROX-27186: Delete conditional code for classic dark theme#13436
pedrottimark merged 3 commits intomasterfrom
ROX-27186-delete-isDarkMode

Conversation

@pedrottimark
Copy link
Contributor

@pedrottimark pedrottimark commented Nov 26, 2024

Description

Problem

On one side of the coin, some classic colors are used only for dark theme that was turned off on 2023-06-10 in #6432

On other side of the coin, accessibility guidelines are easier to reinforce via rules with as much PatternFly as possible, and even then, rarely className or color props and usually semantic color with variant prop:

  • 1.4.1 Use of color
  • 1.4.3 Contrast (Minimum)

Analysis

Find in Files

  • useTheme() has 18 results in 18 files.
  • isDarkMode has 76 results in 22 files.
  • bg-base-0 has 7 results in 6 files before changes, but none after changes.
  • bg-primary-100 has 8 results in 7 files before changes, but 6 results in 6 files after changes.
  • bg-primary-300 has 3 results in 2 files before changes, but 2 results in 1 file after changes.

Solution

  1. Delete isDarkMode conditional rendering.
  2. Delete bg-primary-100 because it is stylistic variation on light background.

Residue

  1. Minimize unneeded classes for classic text and background color after we fix remaining accessibility issues for 1.4.1 guideline for use of color.

User-facing documentation

  • CHANGELOG update is not needed
  • documentation PR is not needed

Testing and quality

  • the change is production ready: the change is GA or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

  1. npm run lint in ui/apps/platform
  2. npm run build in ui/apps/platform and then compute branch - master for the following
    • wc build/static/js/*.js
      main.js -22536 = 4615497 - 4638033 some code moved to another bundle
      total -2541 = 11553577 - 11556118
    • ls -al build/static/js/*.js | wc
      files 0 = 179 - 179
  3. npm run start in ui/apps/platform

Manual testing

  1. Visit /main/compliance

    • With isDarkMode before changes, see presence of text-base-100 that is not used.
      ComplianceDashboardPage_with_isDarkMode

    • Without isDarkMode after changes, see absence and the usual hover background.
      ComplianceDashboardPage_without_isDarkMode

  2. Visit /main/vulnerability-management/images and then click to open side panel.

    • With isDarkMode before changes, see Related entities area has blue background color.
      RelatedEntitiesSideList_with_isDarkMode

    • Without isDarkMode after changes, see Related entities area has same background color as rest of side panel content.
      RelatedEntitiesSideList_without_isDarkMode

    Remove ThemeProvider that dynamically sets class attribute of body element.

    • Without static class="theme-light" attribute before changes, see absence of match for some style rules.
      index_without_theme_class

    • With static class="theme-light" attribute after changes, see absence of match for some style rules.
      index_with_theme_class

  3. Visit /main/configmanagement/namespaces click to open side panel and then click to visit single page.

    • With isDarkMode before changes, see presence of line break in class attribute.
      GroupedTabs_with_isDarkMode

    • Without isDarkMode after changes, see absence of line break in class attribute, but same style.
      GroupedTabs_without_isDarkMode

@pedrottimark pedrottimark requested a review from a team as a code owner November 26, 2024 19:53
@rhacs-bot
Copy link
Contributor

Images are ready for the commit at 188d31b.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.7.x-183-g188d31bea9.

@openshift-ci
Copy link

openshift-ci bot commented Nov 26, 2024

@pedrottimark: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/gke-ui-e2e-tests 188d31b link false /test gke-ui-e2e-tests
ci/prow/ocp-4-17-ui-e2e-tests 188d31b link false /test ocp-4-17-ui-e2e-tests

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@pedrottimark pedrottimark merged commit c3ad0e1 into master Dec 4, 2024
@pedrottimark pedrottimark deleted the ROX-27186-delete-isDarkMode branch December 4, 2024 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants