Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃摉] Portal recipe gives a lexical-scope-error #6176

Closed
intellix opened this issue Apr 29, 2024 · 1 comment
Closed

[馃摉] Portal recipe gives a lexical-scope-error #6176

intellix opened this issue Apr 29, 2024 · 1 comment
Assignees
Labels
COMP: docs Improvements or additions to documentation STATUS-1: needs triage New issue which needs to be triaged

Comments

@intellix
Copy link
Contributor

intellix commented Apr 29, 2024

Suggestion

In the example of the Portals, it recommends having an array of Portal instances https://qwik.dev/docs/cookbook/portals/#using-the-portalprovider. Those instances contain a property called jsx: JSXOutput which causes the valid-lexical-scope to throw a warning/error: https://qwik.dev/docs/advanced/eslint/#valid-lexical-scope

Should the example include a disable for the lint error, or is there an improvement within v2 perhaps that allows the linting rule to not fail there?

portal.close = $(() => {
  // eslint-disable-next-line qwik/valid-lexical-scope
  portals.value = portals.value.filter((p) => p !== portal);
});
@intellix intellix added COMP: docs Improvements or additions to documentation STATUS-1: needs triage New issue which needs to be triaged labels Apr 29, 2024
@thejackshelton
Copy link
Member

Hey @intellix! This is an early on portal approach that allows you to project content using context. Hence the valid lexical scope warnings.

This is because projection is currently not native to the framework. My understanding, is that v2 will have projection that enables much easier portal behavior that the framework is aware of. (to confirm that this is still the case @wmertens

Regardless, portals are no longer the standard, as there is native top layer behavior that now takes precedence over portals, which were previously a hack with stacking contexts. If you continue to use a portal, something using the popover api / top layer is going to be above your content.

As an alternative, I would look into the popover api, dialog element, or Qwik UI which intends to this all for you. Hoped this helps! I'll be closing this issue for now, let me know if you have any other questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
COMP: docs Improvements or additions to documentation STATUS-1: needs triage New issue which needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants