fix: hide search + hide notification toggles their elements for v16#23
Open
sparsh-dhris wants to merge 3 commits into
Open
fix: hide search + hide notification toggles their elements for v16#23sparsh-dhris wants to merge 3 commits into
sparsh-dhris wants to merge 3 commits into
Conversation
- toggleSearchBar() now matches both the v15 navbar selector and the v16 sidebar selector (.body-sidebar .navbar-search-bar), and restores the element's display when the role no longer matches. - New toggleNotification() reads the previously-orphaned hide_notification field and toggles .sidebar-notification (v16) / .dropdown-notifications (v15). - Both wired into applyTheme() and the existing MutationObserver so they survive sidebar re-renders. - Added schema + data-layer unit tests and opt-in Playwright E2E tests (gated by DESK_THEME_E2E_SITE env var to keep standard CI fast).
24a46db to
6adaa81
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Two Desk Theme settings don't work on Frappe v16:
hide_notification) — toggling has no effect.hide_search, role-based) — toggling has no effect.Root cause
In
frappe_desk_theme.bundle.js:toggleSearchBar()queries.input-group.search-bar.text-muted— the v15 navbar selector. In v16 the search moved to the sidebar (.body-sidebar .navbar-search-bar), so the lookup returnsnulland the function silently no-ops. It also only hides, never restores.hide_notificationis defined indesk_theme.jsonand served by the API, but no JS code reads it. Zero consumers.Fix
JS-only, no schema or API change.
toggleSearchBar()now matches both the v15 and v16 selectors and restoresdisplay: ""when the role no longer matches (reversible).toggleNotification()readshide_notificationand toggles.body-sidebar .sidebar-notification(v16) /.navbar-nav .dropdown-notifications(v15).applyTheme()and the existingMutationObserverinsetupEventListeners()so they survive sidebar re-renders.Tests
Added to
test_desk_theme.py:test_doctype_exposes_hide_notification_and_hide_search_fieldstest_api_round_trips_both_fieldstest_hide_notification_flag_actually_hides_sidebar_bellDESK_THEME_E2E_SITEtest_hide_search_for_role_actually_hides_sidebar_searchDESK_THEME_E2E_SITESchema/API tests use
unittest.TestCaseto bypass Frappe's transitive fixture loader (which can fail on sites with customisedToDo/Email Accountdoctypes).Local verification
5 scenarios run against a live v16 site — all pass, including the all-off-after-all-on case that proves reversibility.
Risk
JS-only, backwards-compatible with v15, rollback =
git revert. Cached themes pick up the fix on next API revalidation.