Skip to content

fix(material/tabs): validate animation duration#33452

Open
crisbeto wants to merge 1 commit into
angular:mainfrom
crisbeto:tabs-animation-duration-validation
Open

fix(material/tabs): validate animation duration#33452
crisbeto wants to merge 1 commit into
angular:mainfrom
crisbeto:tabs-animation-duration-validation

Conversation

@crisbeto

Copy link
Copy Markdown
Member

Adds some logic to validate the animation duration for the data before assigning it to the DOM. Along the same lines as 0df0042.

Adds some logic to validate the animation duration for the data before assigning it to the DOM. Along the same lines as 0df0042.
@crisbeto crisbeto added the target: patch This PR is targeted for the next patch release label Jun 26, 2026
@pullapprove pullapprove Bot requested review from ok7sai and tjshiu June 26, 2026 07:31
export function normalizeDuration(value: string | number): string {
const stringValue = value + '';

if (/^[0-9]+(?:\.[0-9]+)?$/.test(stringValue)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should it be /^[0-9]*? * instead of + because number like .5 is valid in CSS

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That's a good point, although we also didn't support it until now either. I'll keep it simple for now and we can revisit if anybody runs into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: material/tabs target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants