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

context drop-down menu #443

Closed
hamed-musallam opened this issue Jan 18, 2023 · 21 comments
Closed

context drop-down menu #443

hamed-musallam opened this issue Jan 18, 2023 · 21 comments

Comments

@hamed-musallam
Copy link
Contributor

@targos

I took a look at the context drop-down menu, it seems you design it for general use so we do not know anything about the element that the context menu opens over it.

let's assume I need to use it over a list or table I need to get the id or any other kind of data to use it once I press on the menu to do whatever I want.

maybe we could have a custom attributes data-context = ""

@targos
Copy link
Member

targos commented Jan 18, 2023

I don't understand your problem. @stropitek ?

@hamed-musallam
Copy link
Contributor Author

for example, we have a table displaying a list of spectra and I need to do an operation in one of the spectra so to do that I right-click on the row and open a context menu. How I can pass the id of the spectrum to the context menu?

@targos
Copy link
Member

targos commented Jan 18, 2023

The way I would implement it is that each row of the table uses its own DropdownMenu. In that case you already have that information where you render the menu so that should be fine.

@hamed-musallam
Copy link
Contributor Author

Do see it is better than having custom attributes per row and using DropdownMenu for the whole table?

@targos
Copy link
Member

targos commented Jan 18, 2023

I don't really see any advantage of having a single menu for the whole table.

@hamed-musallam
Copy link
Contributor Author

@targos

Thanks, Michael, can you expose the MenuOptions ?

@hamed-musallam
Copy link
Contributor Author

I don't really see any advantage of having a single menu for the whole table.

But I think there is an advantage, we have a single drop-down context instead of having a drop-down menu in each table cell.

@targos
Copy link
Member

targos commented Jan 18, 2023

That's a fact. But how is it an advantage?

@hamed-musallam
Copy link
Contributor Author

hamed-musallam commented Jan 18, 2023

I tested it per table header <th> , you can see the result

image

That's a fact. But how is it an advantage?

just I mean we do not have to wrap the dropdown menu in each cell, nothing more

@hamed-musallam
Copy link
Contributor Author

I tested it per table header <th> , you can see the result

image

That's a fact. But how is it an advantage?

just I mean we do not have to wrap the dropdown menu in each cell, nothing more

@targos

this happen because i need to set /* overflow: hidden; */ to ellipses the header

@hamed-musallam
Copy link
Contributor Author

hamed-musallam commented Jan 18, 2023

@targos

I think the menu should be injected at the level of the table to avoid these style problem

image

@targos
Copy link
Member

targos commented Jan 18, 2023

No, we should be using a Portal

@hamed-musallam
Copy link
Contributor Author

But you are using a Portal

<Portal>
<div ref={ref}>
<div ref={setPopperElement} {...popperProps}>
<MenuItems
itemsStatic
onSelect={(selected) => {
closeItems();
onSelect(selected);
}}
{...otherProps}
/>
</div>
</div>
</Portal>

@hamed-musallam
Copy link
Contributor Author

hamed-musallam commented Jan 18, 2023

@targos

I think the menu should be injected at the level of the table to avoid these style problem

image

@targos but we have the menu inside the th as you can see??? and we have RootLayout as the root of the nodes tree, Is the wrong in how i use the component

@targos
Copy link
Member

targos commented Jan 18, 2023

I don't know exactly, but there's definitely something wrong somewhere. If you could reproduce it in a story in this repo that would be perfect.

@hamed-musallam
Copy link
Contributor Author

@targos

i found the problem it is here

if (trigger === 'contextMenu') {
return <DropdownContextMenu {...otherProps} />;
}

@targos
Copy link
Member

targos commented Jan 18, 2023

What's the problem?

@hamed-musallam
Copy link
Contributor Author

hamed-musallam commented Jan 18, 2023

@targos
you are not using the Portal if the trigger== "contextMenu" but if its value click you use it and it works well as expected

check DropdownContextMenu component

@targos
Copy link
Member

targos commented Jan 18, 2023

Could you make a fix (and a story that demonstrates it)?

@hamed-musallam
Copy link
Contributor Author

@targos

can you check the PR #444

@targos
Copy link
Member

targos commented Jan 18, 2023

Fixed in v0.20.0. Thanks for the PR.

@targos targos closed this as completed Jan 18, 2023
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

No branches or pull requests

2 participants