vuematerial/vue-material

MdDialog to target specific element

mikimoresi opened this issue · 1 comments

Hello,
I have modified MdOverlay and MdDialog to add mdTarget prop.
In this way it is possible to make a dialog appear inside a specific element.
Passing in mdTarget prop an HTML element, the dialog and the overlay will appear in the given element and will not overlay the entire window.
Because of the position:fixed attribute that cannot target a specific element with position:relative, i have used position absolute both for MdDialog and MdOverlay in case of mdTarget exists. Plus, when mdTarget exists the overflow of the given element will be forced to "hidden" when dialog is active and go back in "auto" when dialog disappear.
The element in mdTarget MUST have position:relative

If you accept the proposal and maybe the commit (I am not allowed to commit) I will work on allowing the dialog to be scrollable if too long and maybe using a class on the mdTarget element instead of forcing the overflow style, this way anybody will be able to use that class for disable scrolling and doing any other desired thing like the required position:relative, the problem with this is that i would use pure js functions to add and remove classes while maybe there is some better approach, I will accept any suggestion.

Is my first commit ever on an open source project (shame on me) so I don't know exactly how contributions works. So please be patient if I'm doing something wrong :)

I have opened a pull request:
MdDialog to target specific element #2254