mui-tiptap icon indicating copy to clipboard operation
mui-tiptap copied to clipboard

feat: Using the tooltip zIndex based on the Mui Theme

Open patrickn2 opened this issue 9 months ago • 1 comments

Simple fix. This will use the theme based zIndex in the Popover and other tooltip components to avoid the tooltip stay behind the mui-tiptap once it is placed on a Dialog/Modal.

https://mui.com/material-ui/customization/default-theme/?expend-path=$.zIndex

I also added a button to open a Dialon with the mui-tiptap inside in the main example.

patrickn2 avatar Apr 29 '24 13:04 patrickn2

I believe I explored this option before, but the problem with using a blanket z-index higher than modals, etc (and not using the container to specify this) is that it means any modal opened on top of a non-modal editor (or any other elements that should have higher z-indexes) will end up behind the tooltips. For instance, if someone wants to open a lightbox/modal for some node in their editor, the bubble menus from the editor should not appear on top of that.

sjdemartini avatar Apr 29 '24 16:04 sjdemartini

Hey @sjdemartini did you have some time to check on this?

patrickn2 avatar Jun 03 '24 13:06 patrickn2

@patrickn2 not yet. In the meantime, https://github.com/sjdemartini/mui-tiptap/issues/206#issuecomment-2133851815 is a workaround. I'm hoping to make it easier to override the z-index, no matter what the default mui-tiptap CSS is, but haven't had a chance to do that yet. I will let you know when I do.

sjdemartini avatar Jun 04 '24 18:06 sjdemartini

@patrickn2 not yet. In the meantime, #206 (comment) is a workaround. I'm hoping to make it easier to override the z-index, no matter what the default mui-tiptap CSS is, but haven't had a chance to do that yet. I will let you know when I do.

The problem is that this solution does not solve the issue with the Link button and the table context menu Probably there are others with the same issue.

patrickn2 avatar Jun 04 '24 20:06 patrickn2

@patrickn2 You can override the styles or container for those in approximately the same way as for the color picker. If we force the z-index to be higher than all modals for every Popper in mui-tiptap, there will no doubt be scenarios where that "breaks" things for people. We can't predict and solve all use cases at once here, so regardless some people will need to override styles to fit their needs.

sjdemartini avatar Jun 04 '24 20:06 sjdemartini

I don't understand, You are telling me about break things for people, the current situation is that is already broken. You can't use mui tip tap in a dialog/modal without setting a bunch of zindexes, This is annoying and takes so much time. I gave you a simple solution that other people can override by changing the theme zindex on MUI Theme.

patrickn2 avatar Jun 04 '24 20:06 patrickn2

I'm saying that regardless of the approach, the scenario can appear "broken" for someone. I already described one such scenario above https://github.com/sjdemartini/mui-tiptap/pull/225#issuecomment-2083157048. I don't intend to keep discussing this, as I have limited time as I've mentioned. There is a current workaround for your use-case. Requiring users to override the global MUI tiptap z-index just for a use-case within mui-tiptap is less ideal than supporting narrower mui-tiptap-scoped style updates, in my opinion (and as MUI states "Customization of individual values is discouraged"), so that is the approach I'd like to move toward.

sjdemartini avatar Jun 04 '24 20:06 sjdemartini