Skip to content

Commit

Permalink
fe105bc93f50921112e4f66a698b3312395c9a6a Fix: If a popover is fixed
Browse files Browse the repository at this point in the history
… position, then attach it to the body, rather than next to the host button

Sync to source repo @fe105bc93f50921112e4f66a698b3312395c9a6a
  • Loading branch information
dtbuild committed Oct 11, 2024
1 parent fd958fe commit 2138813
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion datatables.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
],
"src-repo": "http://github.com/DataTables/Buttons",
"last-tag": "3.1.2",
"last-sync": "8ab9e3841286f90654d29150a6f28c7b286f5eb1"
"last-sync": "fe105bc93f50921112e4f66a698b3312395c9a6a"
}
5 changes: 3 additions & 2 deletions js/dataTables.buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,8 @@ $.extend(Buttons.prototype, {

var containerSelector =
options.tag + '.' + options.containerClassName.replace(/ /g, '.');
var hostNode = hostButton.node();
var hostButtonNode = hostButton.node();
var hostNode = options.collectionLayout.includes('fixed') ? $('body') : hostButton.node();

var close = function () {
closed = true;
Expand Down Expand Up @@ -1483,7 +1484,7 @@ $.extend(Buttons.prototype, {
.attr('role', 'menu')
.appendTo(display);

hostNode.attr('aria-expanded', 'true');
hostButtonNode.attr('aria-expanded', 'true');

if (hostNode.parents('body')[0] !== document.body) {
hostNode = document.body.lastChild;
Expand Down
2 changes: 1 addition & 1 deletion js/dataTables.buttons.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/dataTables.buttons.min.mjs

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions js/dataTables.buttons.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,8 @@ $.extend(Buttons.prototype, {

var containerSelector =
options.tag + '.' + options.containerClassName.replace(/ /g, '.');
var hostNode = hostButton.node();
var hostButtonNode = hostButton.node();
var hostNode = options.collectionLayout.includes('fixed') ? $('body') : hostButton.node();

var close = function () {
closed = true;
Expand Down Expand Up @@ -1443,7 +1444,7 @@ $.extend(Buttons.prototype, {
.attr('role', 'menu')
.appendTo(display);

hostNode.attr('aria-expanded', 'true');
hostButtonNode.attr('aria-expanded', 'true');

if (hostNode.parents('body')[0] !== document.body) {
hostNode = document.body.lastChild;
Expand Down

0 comments on commit 2138813

Please sign in to comment.