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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ Bug Report ] Wrong Dropdown example code #260

Closed
HipyCas opened this issue Aug 25, 2021 · 2 comments
Closed

[ Bug Report ] Wrong Dropdown example code #260

HipyCas opened this issue Aug 25, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@HipyCas
Copy link

HipyCas commented Aug 25, 2021

Environment

- **browser**: Mozilla Firefox 91.0.1
- **equal**: 0.79.3
- **vue**: 3.1.4

Current Behavior

The dropdown (it-dropdown) component is appearing open always, whether you're hovering, clicking or none of them. It even gets weirder when I try to use Vue's shorter version for slot="menu", #menu, which makes the whole component break.

It first appeared when using it in a flex container, that made me think that the problem could be with the flex display, or maybe with how I had written it. And so I tested the official example both inside the flex container and outside of it, and I still got the same problem.

The dropdown menu links and buttons work flawlessly, just the opening and closing is what is not working. No other component is giving me errors.

For the first case, this is the code and screenshot:

<template>
  <div id="container">
      <p>{{ file.name }}</p>
      <it-dropdown>
        <it-button icon="more_vert" round text slot="default"></it-button>
        <it-dropdown-menu slot="menu">
          <it-dropdown-item icon="download" @click="navigate(file.download_url)"
            >Download</it-dropdown-item
          >
          <it-dropdown-item icon="visibility" @click="navigate(file.contents_url)"
            >View</it-dropdown-item
          >
          <it-dropdown-item icon="info" @click="drawerVisible = true"
            >About</it-dropdown-item
          >
        </it-dropdown-menu>
      </it-dropdown>
    </div>
</template>

<style>
#container {
  display: flex;
  justify-content: space-between;
  border-radius: 1em;
  border-width: 0.1em;
  box-shadow: 10px 0 30px 0 #88888888;
  padding: 1em;
}
</style>

Screenshot from 2021-08-25 17-12-18

The second case:

<template>
  <router-view></router-view>
  <it-dropdown>
    <it-button>Hover me</it-button>
    <it-dropdown-menu slot="menu">
      <it-dropdown-item>Hello</it-dropdown-item>
      <it-dropdown-item disabled>Disabled</it-dropdown-item>
      <it-dropdown-item icon="cloud">Cloud</it-dropdown-item>
      <it-dropdown-item divided>Divided</it-dropdown-item>
    </it-dropdown-menu>
  </it-dropdown>
</template>

Screenshot from 2021-08-25 17-12-36

Expected Behavior

To simply work, as stated in the documentation. I thought I was writing it incorrectly, but the fact that the documentation example doesn't work is just driving me crazy.

Steps To Reproduce

  1. Create a vue app with the version mentioned before (I am using vite)
  2. Install and enable globally equal components.
  3. Personally, I'm also using the Inter font through their NPM package and downloaded Material Icons CSS
  4. Copy and paste the dropdown example in the docs or build your owm
  5. Serve and see

Anything else?

No response

@HipyCas HipyCas added the bug Something isn't working label Aug 25, 2021
@HipyCas
Copy link
Author

HipyCas commented Aug 25, 2021

SOLUTION FOUND
I was so confused by this that I went to the docs Vue pages to see how you got them working, and found out that the docs were wrong. As opposed to the code shown to the user in the docs (shown above), the inner workings or the codes are like this:

<it-dropdown>
  <it-button>Hover me</it-button>
  <template #menu>
    <it-dropdown-menu>
      <it-dropdown-item>Hello</it-dropdown-item>
      <it-dropdown-item disabled>Disabled</it-dropdown-item>
      <it-dropdown-item icon="cloud">Cloud</it-dropdown-item>
      <it-dropdown-item divided>Divided</it-dropdown-item>
    </it-dropdown-menu>
  </template>
</it-dropdown>

Making use of the template tag, it works perfectly (I also tried using the optional <template #default> for the button, which also worked perfectly).

What to fix?
Just have to change the docs to make use of the template tag. I could try do that myself if you'd like.

@HipyCas HipyCas changed the title [ Bug Report ] Dropdown always open [ Bug Report ] Wrong Dropdown example code Aug 25, 2021
@quatrochan
Copy link
Collaborator

I could try do that myself if you'd like.

It'd be nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants