conversionxl / aybolit

Lightweight web components library built with LitElement.
https://conversionxl.github.io/aybolit/
MIT License
7 stars 8 forks source link

fix(cxl-ui): [cxl-marketing-nav] display descriptions on sub-menus #248

Closed anoblet closed 1 year ago

anoblet commented 1 year ago

https://app.clickup.com/t/861m7gmrz

github-actions[bot] commented 1 year ago

size-limit report 📦

Path Size
packages/cxl-ui/pkg/dist-web/cxl-ui-jwplayer.js, packages/cxl-ui/pkg/dist-web/cxl-ui-playbooks.js, packages/cxl-ui/pkg/dist-web/cxl-ui.js 65.6 KB (+0.06% 🔺)
anoblet commented 1 year ago

opened-changed only fires once when the top level menu is opened. The submenu items have yet to be rendered, and aren't able to be modified.

MutationObserver watches for any add/removal of nodes with the optional ability to observe attributes as well. You can also specify subTree: true for observing deep changes.

This use case of MutationObserver is pretty efficient. Since it only registers on firstUpdated and only watches the add/removal direct descendants of document.body, it should only fire on menu clicks.

pawelkmpt commented 1 year ago

@lkraav can we merge it?

lkraav commented 1 year ago

@lkraav can we merge it?

I don't know, haven't been able to evaluate whether this is best available practice. Asking on Vaadin Discord would help convince.

anoblet commented 1 year ago

@lkraav https://discord.com/channels/732335336448852018/1064939525731790969/1064939525731790969

pawelkmpt commented 1 year ago

I see someone on Discord suggested different solution. Will you use it @anoblet ?

anoblet commented 1 year ago

@pawelkmpt I have updated the PR to use the technique from Vaadin Discord.