Skip to content

Commit

Permalink
3.0.0-alpha.3 release
Browse files Browse the repository at this point in the history
  • Loading branch information
enact-bot committed Dec 2, 2024
2 parents d6d9828 + 808ea41 commit d3a3b5b
Show file tree
Hide file tree
Showing 65 changed files with 1,414 additions and 2,239 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
dist: jammy
language: node_js
node_js:
- lts/*
- node
- 21
sudo: false
before_install:
- curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-4.4.gpg --dearmor
Expand Down
64 changes: 64 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,74 @@

The following is a curated list of changes in the Enact sandstone module, newest changes on the top.

## [3.0.0-alpha.3] - 2024-12-02

### Added

- `sandstone/Icon` supported icon list, adding new icons `ai`, `alert01`, and `alert02`
- `sandstone/PageViews` prop `autoFocus` to set whether focus element automatically or not
- `sandstone/PageViews.Page` and `sandstone/QuickGuidePanels.Panel` prop `aria-label`
- `sandstone/QuickGuidePanels` props `closeButtonAriaLabel` and `onClose`

### Fixed

- `sandstone/ContextualPopupDecorator` to update popup position properly when the screen orientation change
- `sandstone/IconItem` to restart marquee after done editing in `sandstone/Scroller` with `editable` prop
- `sandstone/Input` keypad layout when `type` prop is `number` or `passwordnumber` and the screen is in portrait mode or `popupType` prop is `overlay` and in large text mode
- `sandstone/PageViews` and `sandstone/QuickGuidePanels` dot page indicators to be aligned center
- `sandstone/PageViews` to not clip the shadow of navigation buttons when `fullContents` prop is `true`
- `sandstone/Scroller` to focus content area properly on supported platforms when `focusableScrollbar` prop is `byEnter`
- `sandstone/Scroller` with `editable` prop to move an item via 5-way keys properly in pointer mode
- `sandstone/Slider` to not show console error when dragging with touch

## [2.9.5] - 2024-11-19

### Added

- `sandstone/Icon` supported icon list, adding new icons `ai`, `alert01`, and `alert02`

### Fixed

- `sandstone/ContextualPopupDecorator` to update popup position properly when the screen orientation change
- `sandstone/Input` keypad layout when `type` prop is `number` or `passwordnumber` and the screen is in portrait mode or `popupType` prop is `overlay` and in large text mode
- `sandstone/Slider` to not show console error when dragging with touch

## [2.7.19] - 2024-11-15

### Fixed

- `sandstone/ContextualPopupDecorator` to update popup position properly when the screen orientation change
- `sandstone/Input` keypad layout when `type` prop is `number` or `passwordnumber` and the screen is in portrait mode or `popupType` prop is `overlay` and in large text mode

## [2.9.4] - 2024-10-29

### Fixed

- `sandstone/IconItem` to restart marquee after done editing in `sandstone/Scroller` with `editable` prop
- `sandstone/PageViews` and `sandstone/QuickGuidePanels` dot page indicators to be aligned center
- `sandstone/Scroller` to focus content area properly on supported platforms when `focusableScrollbar` prop is `byEnter`
- `sandstone/Scroller` with `editable` prop to move an item via 5-way keys properly in pointer mode

## [2.9.3] - 2024-10-15

### Added

- `sandstone/MediaControls` props `jumpBackwardAriaLabel` and `jumpForwardAriaLabel` to override aria-label of jumpButtons
- `sandstone/PageViews` prop `autoFocus` to set whether focus element automatically or not

### Fixed

- `sandstone/PageViews` to not clip the shadow of navigation buttons when `fullContents` prop is `true`
- `sandstone/Scroller` to focus the topmost element after scroll by voice control
- `sandstone/Scroller` to read out properly when `sandstone/Panels` has `sandstone/Scroller` with `focusableScrollbar`
- `sandstone/VideoPlayer` to show only the mini feedback when pressing play/pause key

## [3.0.0-alpha.2] - 2024-10-08

### Added

- `sandstone/Alert` public class names `alert`, `content`, `fullscreen`, and `title`
- `sandstone/MediaControls` props `jumpBackwardAriaLabel` and `jumpForwardAriaLabel` to override aria-label of jumpButtons
- `sandstone/Steps` prop `highlightCurrentOnly` to highlight and scale only the current step

### Changed
Expand All @@ -18,6 +81,7 @@ The following is a curated list of changes in the Enact sandstone module, newest
- `sandstone/Panels.Header` to show title and subtitle properly in `sandstone/WizardPanels`
- `sandstone/Scroller`, `sandstone/Slider`, and `sandstone/VirtualList` to have default prop when `undefined` prop is passed
- `sandstone/Scroller` to show scroll indicator when `focusableScrollbar` prop is `true`
- `sandstone/Scroller` to focus the topmost element after scroll by voice control
- `sandstone/Scroller` to read out properly when `sandstone/Panels` has `sandstone/Scroller` with `focusableScrollbar`
- `sandstone/Steps` prop `size` to accept number type
- `sandstone/VideoPlayer` to show only the mini feedback when pressing play/pause key
Expand Down
26 changes: 26 additions & 0 deletions ContextualPopupDecorator/ContextualPopupDecorator.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global ResizeObserver */

/**
* A higher-order component to add a Sandstone styled popup to a component.
*
Expand Down Expand Up @@ -272,6 +274,7 @@ const Decorator = hoc(defaultConfig, (config, Wrapped) => {
activator: null
};

this.resizeObserver = null;
this.overflow = {};
this.adjustedDirection = this.props.direction;
this.id = this.generateId();
Expand All @@ -292,6 +295,12 @@ const Decorator = hoc(defaultConfig, (config, Wrapped) => {
on('keydown', this.handleKeyDown);
on('keyup', this.handleKeyUp);
}

if (typeof ResizeObserver === 'function') {
this.resizeObserver = new ResizeObserver(() => {
this.positionContextualPopup();
});
}
}

getSnapshotBeforeUpdate (prevProps, prevState) {
Expand Down Expand Up @@ -341,6 +350,11 @@ const Decorator = hoc(defaultConfig, (config, Wrapped) => {
off('keyup', this.handleKeyUp);
}
Spotlight.remove(this.state.containerId);

if (this.resizeObserver) {
this.resizeObserver.disconnect();
this.resizeObserver = null;
}
}

generateId = () => {
Expand Down Expand Up @@ -593,6 +607,18 @@ const Decorator = hoc(defaultConfig, (config, Wrapped) => {

getContainerNode = (node) => {
this.containerNode = node;

if (this.resizeObserver) {
if (node) {
// It is not easy to trigger changed position of activator,
// so we chose to observe the `div` element's size that has the real size below the root of floatLayer.
// This implementation is dependent on the current structure of FloatingLayer,
// so if the structure have changed, below code needs to be changed accordingly.
this.resizeObserver.observe(node?.parentElement?.parentElement);
} else {
this.resizeObserver.disconnect();
}
}
};

handle = handle.bind(this);
Expand Down
36 changes: 36 additions & 0 deletions ContextualPopupDecorator/tests/ContextualPopupDecorator-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,4 +505,40 @@ describe('ContextualPopupDecorator Specs', () => {
expect(scrimDivFirst).toHaveClass(expectedFirst);
expect(scrimDivSecond).toHaveClass(expectedSecond);
});

test('should create and observe with `ResizeObserver` when the popup opened and disconnect when the popup closed', () => {
const originalObserver = global.ResizeObserver;

const MockObserverInstance = {
observe: jest.fn(),
disconnect: jest.fn()
};
global.ResizeObserver = jest.fn().mockImplementation(() => MockObserverInstance);

const Root = FloatingLayerDecorator('div');
const {rerender} = render(
<Root>
<ContextualButton data-testid="contextualButton" open popupComponent={() => <div><Button>Button</Button></div>}>
Hello
</ContextualButton>
</Root>
);

const contextualButton = screen.getByTestId('contextualButton');

expect(contextualButton).toBeInTheDocument();
expect(MockObserverInstance.observe).toHaveBeenCalled();

rerender(
<Root>
<ContextualButton data-testid="contextualButton" popupComponent={() => <div><Button>Button</Button></div>}>
Hello
</ContextualButton>
</Root>
);

expect(MockObserverInstance.disconnect).toHaveBeenCalled();

global.ResizeObserver = originalObserver;
});
});
Loading

0 comments on commit d3a3b5b

Please sign in to comment.