Skip to content

Support legacy Obsidian keyed Notices - #51

Merged
vrtmrz merged 1 commit into
mainfrom
fix/keyed-notice-legacy-compat
Aug 24, 2026
Merged

Support legacy Obsidian keyed Notices#51
vrtmrz merged 1 commit into
mainfrom
fix/keyed-notice-legacy-compat

Conversation

@vrtmrz

@vrtmrz vrtmrz commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Make KeyedNoticeManager compatible with Obsidian hosts that do not expose Notice.messageEl while preserving its public API and keyed lifecycle behaviour.

Obsidian added Notice.messageEl in 1.8.7. The manager previously read it for connectivity and class placement, preventing scoped use on older hosts even though the Notice constructor accepts a DocumentFragment.

Summary

  • retain a manager-owned message root supplied to Obsidian through a DocumentFragment
  • update string and DocumentFragment content directly without calling Notice.setMessage
  • detect click dismissal during the host hide transition and replace acknowledged Notices on the next update
  • preserve modern-host coverage and add a legacy Notice double with no messageEl or noticeEl
  • document the scoped compatibility while retaining the package-wide obsidian >=1.8.7 peer dependency
  • extend the real-Obsidian Notice scenario to verify dismissal creates a fresh DOM root

Test-first evidence

  • the initial legacy-host show test failed before the production change at KeyedNoticeManager.show with a TypeError reading messageEl.classList
  • the completed focused Notice suite passes all 21 tests

Verification

  • npm run check
  • npm test
  • npm run build
  • npm run test:e2e:obsidian:notices against reviewed Obsidian 1.13.6
  • NODE_OPTIONS=--max-old-space-size=3072 npm run verify:workspace
  • packed package and packed-consumer verification
  • git diff --check

@vrtmrz
vrtmrz merged commit 6419699 into main Aug 24, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant