Skip to content

Layer fix #2121

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

Merged
merged 5 commits into from
Oct 27, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/components/updatemenus/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ module.exports = function draw(gd) {

// remove exiting header, remove dropped buttons and reset margins
if(headerGroups.enter().size()) {
// make sure gButton is on top of all headers
gButton.node().parentNode.appendChild(gButton.node());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done.


gButton
.call(removeAllButtons)
.attr(constants.menuIndexAttrName, '-1');
Expand Down Expand Up @@ -135,13 +138,12 @@ module.exports = function draw(gd) {
});
};

/**
* get only visible menus for display
*/
function makeMenuData(fullLayout) {
var contOpts = fullLayout[constants.name],
menuData = [];

// Filter visible dropdowns and attach '_index' to each
// fullLayout options object to be used for 'object constancy'
// in the data join key function.
var contOpts = fullLayout[constants.name];
var menuData = [];

for(var i = 0; i < contOpts.length; i++) {
var item = contOpts[i];
Expand All @@ -154,7 +156,7 @@ function makeMenuData(fullLayout) {

// Note that '_index' is set at the default step,
// it corresponds to the menu index in the user layout update menu container.
// Because a menu can b set invisible,
// Because a menu can be set invisible,
// this is a more 'consistent' field than the index in the menuData.
function keyFunction(menuOpts) {
return menuOpts._index;
Expand Down
4 changes: 4 additions & 0 deletions test/jasmine/tests/updatemenus_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,10 @@ describe('update menus interactions', function() {
// fold up buttons whenever new menus are added
assertMenus([0, 0]);

// dropdown buttons container should still be on top of headers (and non-dropdown buttons)
var gButton = d3.select('.updatemenu-dropdown-button-group');
expect(gButton.node().nextSibling).toBe(null);

return Plotly.relayout(gd, {
'updatemenus[0].bgcolor': null,
'paper_bgcolor': 'black'
Expand Down