mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
chore(): sync with main
This commit is contained in:
@ -84,6 +84,22 @@ export class Segment implements ComponentInterface {
|
||||
* Used by `ion-segment-button` to determine if the button should be checked.
|
||||
*/
|
||||
this.ionSelect.emit({ value });
|
||||
|
||||
if (this.scrollable) {
|
||||
const buttons = this.getButtons();
|
||||
const activeButton = buttons.find((button) => button.value === value);
|
||||
if (activeButton !== undefined) {
|
||||
/**
|
||||
* Scrollable segment buttons should be
|
||||
* centered within the view including
|
||||
* buttons that are partially offscreen.
|
||||
*/
|
||||
activeButton.scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
inline: 'center',
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user