Bootstrap 4 dropdown menu hidden and flickering - drop-down-menu

I've looked at other posts, but they appear 3-4 years old, and Bootstrap/Popper has many changes.
I have a menu dropdown in Bootstrap 4 that is inside a container with a transform/translate2d on it. When the dropdown menu appears, it is below another container on the page (regardless of z-index) and it flickers a bunch as I move the mouse over it. This occurs in Chrome and Firefox so I think it is related to Bootstrap and their Popper.js use.
If I remove the transform/translate3d on the big container that the dropdown menu is inside of, things work fine.
Here is an example; just click the dropdown arrow to see the overlap issue. Then you an move the mouse over the end of the "Minimum Count" row to see some flickering. If you comment out this CSS line, it works fine.
transform: translate3d(0%, -8px, 0);
https://jsfiddle.net/paultechguy/mtcbLt5t/30/

After much investigation, this was an issue with the "stacking context" for browsers. The Bootstrap 4 / Popper.js dropdown menu does a CSS transform/translate3d and this was the culprit. To solve, make these CSS changes:
Parent element of the container that has the dropdown menu (this is two up from the dropdown menu):
position: relative;
z-index: 10;
Then on the container that has the dropdown menu:
z-index: 20; /* a value higher then the 10 above */
Hope this helps others.

Related

Bootstrap tooltip doesn't hide when modal triggered if placement=body

I have a kendo grid which each row has an edit button. I am using Bootstrap to add a tooltip to the edit button, as well as other things. The edit button brings up a window to edit the attributes of the row model.
The tooltip kept getting cut off by the boundaries of the grid. To solve this I used placement=body when initializing the tooltips.
The problem I have now, is that the the tooltip does not hide if the button is clicked, and the editor window comes up. I tried changing the trigger to just be 'hover', but that did not help.
I tried doing ('[title]').tooltip('hide') in the edit event of the grid, but that doesn't seem to work at all.
I believe the problem has to do with 'edit' opening a kendo window. Because the other buttons with tooltips are fine, as they trigger a BootstrapDialog.
What happens is that the .tooltip has a z-index of 1070 while .modal has a z-index of 1050.
You can add the following to your css to ensure that .tooltip is displayed below .modal :
.modal{
z-index: 1071;
}
Of course, this means that you absolutely can't have a tooltip displayed from inside your modal, so this maybe doesn't suit your specific needs.
If that's the case, you should be able to add another class to your tooltip div and override the z-index on this class.
I'm well aware of the monkey-patch nature of this fix, but I've looked for a solution for this for weeks and couldn't find anything better.

How can I set the width of a second level Mmenu menu?

I have successfully setup Mmenu on a WordPress theme - loving Mmenu so far. But I need to change the width of the second level menu to make it a little wider than the top level menu.
I can change the width of the parent container, however this affects the top level menu too.
.mm-menu {
width:320px !important;
}
I am open to CSS or Javascript solutions. Although I don't think a CSS solution is possible.
Has anyone done this before?
I reduced the width by changing the values on the media query "#media all and (min-width: 440px;){html.mm-opening .mm-slideout {}}".

Joomla modal window "sbox" popup shifts background to the right

I have noticed for a while that Joomla´s build in modal popup "sbox" moves the background (the entire body of the site) ca. 10 pixels to the right when I open a popup window. When I close the popup window the page is shifted back 10 pixels to the left.
You can see the problem on this page:
http://www.traelastogbyggemarked.dk/vaerktoj/arbejdsbeklaedning/traesko/euro-dan-pu-finer-toffel-sort-detaljer
Just click on the product image and you can see the background moving.
I have noticed this on other sites aswell, for instance on this page page:
http://demo.joomlaxtc.com/free/index.php/modal-box-plugin
click on the demo link "Click Here"
The problem appears to be present in all browsers. As far as I know the sbox modal popup is a part of Joomla´s build-in mootools core. My site is running Joomla 2.5
Does anyone know how I can change this behavior and stop the modal popup from moving the background?
Check the modal.css and look for this:
/* Hides scrollbars */
.body-overlayed {
overflow: hidden;
}
Try without it.
This should resolve the apparent shift:
/* Hides scrollbars */
.body-overlayed {
overflow: hidden;
width: calc(100% - 16px);}
It subtracts the width of the scrollbar from the element when the class is applied.

Page jumps to the top when checkbox is clicked

I'm calling handleNotableTypeSelect method on the click of the check box, everything is working fine but the page jumps to the top.
this.$hideInactiveCheckbox.click(
this.handleNotableTypeSelect.createDelegate(this));
handleNotableTypeSelect: function(e) {
//e.preventDefault();
if (this.$hideInactiveCheckbox.attr('checked')) {
this.isActive = "^active$";
this.$connTable.fnFilter(this.isActive, 1,true);
}
else {
this.$connTable.fnFilter('', 1);
}
//return false;
}
My case was that the checkbox was hidden (due to CSS design). the original input checkbox had position set to 'absolute' so when the user clicked the checkbox the page "jumped" to the real checkbox position.
EDIT:
In some cases there are styled "fake" checkboxes. the real checkbox element is hidden in some bad practice way.
My case was that the real checkbox element had absolute positioning and hidden and that cause the page jump to top of the window.
Possible solution:
Check if the checkbox element has the following CSS rule
position: absolute;
if yes, removing this rule can fix this issue.
This may related to the following issue:
input checkbox in div jumps to top of page on firefox
I've actually been seeing errors about this in all kinds of frameworks, and for the most part, people post framework specific answers. If you're hiding the check box, try using display: none on it, it seemed to work for the post above. I'm still trying to hunt down a fix (since I'm not hiding my checkboxes, I'm trying figure out why checkboxes in a modal cause the screen to jump to the top of the modal on click).
Several frameworks and css tricks hide the checkbox using position: absolute.
That is correct because we need to hide the checkbox only from screen, while Screen Readers must have access to it in order to announce it correctly. But display:none hides it from them too and users with accessibility issues can't click it.
The most suitable solution is to add position:relative to checkbox container and adjust checkbox position using top: if needed.
If your check box has position: absolute, in most cases just wrapping it (input and label elements) with a div should be enough.
If the checkbox has been positioned absolute to hide it and the interaction occurs on the label (which is commonplace when styling checkboxes beyond the default UI), the page will scroll to wherever the checkbox input is positioned despite the click event occurring on the label. so if you've added top:-9999px; for example, the page will jump right up to where it's now positioned.
What you want instead, is to remove it from the rendered layout without moving it away from the label. to do this, add a container div to the label and input, and add position:relative; to it. Then add the following code to the input itself:
position:absolute;
top:0; left:0;
visibility: hidden;
opacity: 0;

CSS drop-down being overlapped by content in IE7

I'm having this issue in IE7 with my drop down. Whenever I hover over my dropdown it goes up as soon as i hover over an element on top of the content. http://www.legrandconfectionary.com/gift-boxes/
I thought a position: relative on the header would solve the problem but on certain pages like the truffle flavors I have a tooltip effect that goes under the nav if done so. I'd really appreciate some help on this. Thanks!
There are several ways that you can fix this. Here's two:
Set the a tag to display: block, and then make your hover events based on the a instead of the li.
or
Specify a height other than auto or 100% for the li's

Resources