question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide uniform/standard/documented way of accessing the outer/inner elements of QDialog/QMenu/QTooltip

See original GitHub issue

What happened?

I have a custom component that wraps QMenu, e.g.:

<template>
  <q-menu ref="menuRef" @show="onShow">
    ... content ...
  </q-menu>
</template>

<script setup>
const menuRef = ref(null)
function onShow () {
  console.log('onShow', menuRef.value.$el)
}
</script>

The problem is - upon showing the menu, the menuRef.value.$el is resolved to #text and not to the actual menu element - please see the codepen below.

What did you expect to happen?

As explained in this thread - https://github.com/quasarframework/quasar/issues/13628 - refs are resolved after @show() - and indeed, I have a QDialog which works OK, but it seems this is not working for QMenu.

Reproduction URL

https://codepen.io/ddenev/pen/BaVaQLx

How to reproduce?

  1. Go to the repro link
  2. Click on the button
  3. Check the console output - it shows that menuRef.value.$el is text and not the menu element

Flavour

Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)

Areas

Components (quasar), SPA Mode

Platforms/Browsers

Chrome

Quasar info output

No response

Relevant log output

No response

Additional context

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
rstoenescucommented, Oct 25, 2022

Do not use internal variables. It will work until it won’t. Will provide a uniform way of accessing the actual content for all portal-based components.

1reaction
pdanpdancommented, Oct 25, 2022

It’s not a bug, just a different way the components are created/used. I’ll reopen this, but please change the title to something like Provide uniform/standard/documented way of accessing the outer/inner elements of QDialog/QMenu/QTooltip

Read more comments on GitHub >

github_iconTop Results From Across the Web

[QUESTION] Stream staleness and connection resets - IssueHint
We have an edge device streaming on device frames into KVS, the frames are received reliably and sent to the cloud.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found