Skip to content

Commit

Permalink
Updated build
Browse files Browse the repository at this point in the history
  • Loading branch information
lane-formio committed Jan 2, 2024
1 parent 389dbec commit cb826b3
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## [Unreleased: 10.2.1-rc.1]
## 10.2.1-rc.1
### Changed
- FIO-7523 Fixed dropdown being inaccessible in flipped state
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@formio/choices.js",
"version": "10.2.0",
"version": "10.2.1-rc.1",
"description": "A vanilla JS customisable text input/select box plugin",
"main": "./public/assets/scripts/choices.js",
"types": "./public/types/src/index.d.ts",
Expand Down
22 changes: 17 additions & 5 deletions public/assets/scripts/choices.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! @formio/choices.js v10.2.0 | © 2023 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
/*! @formio/choices.js v10.2.1-rc.1 | © 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
Expand Down Expand Up @@ -543,7 +543,7 @@ var Choices = /** @class */function () {
}
requestAnimationFrame(function () {
_this.dropdown.show();
_this.containerOuter.open(_this.dropdown.distanceFromTopWindow);
_this.containerOuter.open(_this.dropdown.distanceFromTopWindow, _this.dropdown.height);
if (!preventInputFocus && _this._canSearch) {
_this.input.focus();
}
Expand Down Expand Up @@ -2129,7 +2129,7 @@ var Container = /** @class */function () {
* Determine whether container should be flipped based on passed
* dropdown position
*/
Container.prototype.shouldFlip = function (dropdownPos) {
Container.prototype.shouldFlip = function (dropdownPos, dropdownHeight, containerElem) {
if (typeof dropdownPos !== 'number') {
return false;
}
Expand All @@ -2138,6 +2138,11 @@ var Container = /** @class */function () {
var shouldFlip = false;
if (this.position === 'auto') {
shouldFlip = !window.matchMedia("(min-height: ".concat(dropdownPos + 1, "px)")).matches;
if (shouldFlip) {
if (containerElem.getBoundingClientRect().top - dropdownHeight < 0) {
shouldFlip = false;
}
}
} else if (this.position === 'top') {
shouldFlip = true;
}
Expand All @@ -2149,11 +2154,11 @@ var Container = /** @class */function () {
Container.prototype.removeActiveDescendant = function () {
this.element.removeAttribute('aria-activedescendant');
};
Container.prototype.open = function (dropdownPos) {
Container.prototype.open = function (dropdownPos, dropdownHeight) {
this.element.classList.add(this.classNames.openState);
this.element.setAttribute('aria-expanded', 'true');
this.isOpen = true;
if (this.shouldFlip(dropdownPos)) {
if (this.shouldFlip(dropdownPos, dropdownHeight, this.element)) {
this.element.classList.add(this.classNames.flippedState);
this.isFlipped = true;
}
Expand Down Expand Up @@ -2257,6 +2262,13 @@ var Dropdown = /** @class */function () {
enumerable: false,
configurable: true
});
Object.defineProperty(Dropdown.prototype, "height", {
get: function () {
return this.element.getBoundingClientRect().height;
},
enumerable: false,
configurable: true
});
Dropdown.prototype.getChild = function (selector) {
return this.element.querySelector(selector);
};
Expand Down
2 changes: 1 addition & 1 deletion public/assets/scripts/choices.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/assets/scripts/choices.min.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/*! @formio/choices.js v10.2.0 | © 2023 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
/*! @formio/choices.js v10.2.1-rc.1 | © 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
4 changes: 2 additions & 2 deletions public/types/src/scripts/components/container.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ export default class Container {
* Determine whether container should be flipped based on passed
* dropdown position
*/
shouldFlip(dropdownPos: number): boolean;
shouldFlip(dropdownPos: number, dropdownHeight: number, containerElem: HTMLElement): boolean;
setActiveDescendant(activeDescendantID: string): void;
removeActiveDescendant(): void;
open(dropdownPos: number): void;
open(dropdownPos: number, dropdownHeight: number): void;
close(): void;
focus(): void;
addFocusState(): void;
Expand Down
2 changes: 1 addition & 1 deletion public/types/src/scripts/components/container.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions public/types/src/scripts/components/dropdown.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default class Dropdown {
* Bottom position of dropdown in viewport coordinates
*/
get distanceFromTopWindow(): number;
get height(): number;
getChild(selector: string): HTMLElement | null;
/**
* Show dropdown to user by adding active state class
Expand Down
2 changes: 1 addition & 1 deletion public/types/src/scripts/components/dropdown.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cb826b3

Please sign in to comment.