Skip to content

fix(animations): normalize final styles in buildStyles - #42763

Closed
dario-piotrowicz wants to merge 4 commits into
angular:masterfrom
dario-piotrowicz:animations-normalize-toStyles
Closed

dario-piotrowicz wants to merge 4 commits into
angular:masterfrom
dario-piotrowicz:animations-normalize-toStyles

Conversation

@dario-piotrowicz

@dario-piotrowicz dario-piotrowicz commented Jul 4, 2021 •

Copy link
Copy Markdown
Contributor

the final styles created in buildStyles lack normalization, meaning that pixel values remain as numbers (without "px") and so such properties fail to be correctly set/applied

Example: "width: 300" would be applied as "width": "300" (and thus ignored) instead of the correct "width": "300px"

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

At the end of animations numerical values are not normalized thus they are not saved correctly

Example with width, notice how the animation widths are ignored at the end:
width-before

stackblitz

Issue Number: #24698

What is the new behavior?

numerical values get normalized at animations end thus fixing the issue

Example after fix:
width-after

Does this PR introduce a breaking change?

  • Yes
  • No

@google-cla google-cla Bot added the cla: yes label Jul 4, 2021
@pullapprove
pullapprove Bot requested a review from IgorMinar July 4, 2021 09:43

@JoostK JoostK left a comment

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.

Heya, thank you for taking a look at this. The animations package is not a simple one to get your hands dirty on.

It would be great if this could have a test. I think the best place for such a test would be in the integration suite located in packages/core/test/animation. I am also a bit concerned about the normalizer being optional.

Comment thread packages/animations/browser/src/util.ts Resolved
@JoostK JoostK added the area: animations legacy animations package only. Otherwise use area: core. label Jul 4, 2021
@ngbot ngbot Bot added this to the Backlog milestone Jul 4, 2021
@JoostK JoostK added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Jul 4, 2021
Comment thread packages/animations/browser/src/util.ts Resolved
Comment thread packages/animations/browser/src/util.ts Resolved
@dario-piotrowicz

Copy link
Copy Markdown
Contributor Author

Heya, thank you for taking a look at this. The animations package is not a simple one to get your hands dirty on.

It would be great if this could have a test. I think the best place for such a test would be in the integration suite located in packages/core/test/animation. I am also a bit concerned about the normalizer being optional.

Thank you very much!!! 😃

About the test, consider it done! 😉

Also the normalizer should definitely not be optional! you're totally right! I'm going to amend it 🙂

@dario-piotrowicz
dario-piotrowicz force-pushed the animations-normalize-toStyles branch 2 times, most recently from f876e92 to 722a99a Compare July 4, 2021 10:24
Comment thread packages/animations/browser/src/util.ts Resolved
@dario-piotrowicz dario-piotrowicz changed the title fix(animations): normalize toStyles on animation player onDestroy fix(animations): normalize styles on animation player setStyles Jul 4, 2021
@dario-piotrowicz
dario-piotrowicz force-pushed the animations-normalize-toStyles branch 2 times, most recently from 42d655a to 4cd0367 Compare July 4, 2021 15:07
@pullapprove
pullapprove Bot requested a review from alxhub July 4, 2021 15:07
Comment thread packages/animations/browser/src/util.ts Resolved
@dario-piotrowicz
dario-piotrowicz requested a review from JoostK July 4, 2021 15:16
@dario-piotrowicz dario-piotrowicz changed the title fix(animations): normalize styles on animation player setStyles fix(animations): normalize styles in animation player setStyles Jul 4, 2021

@JoostK JoostK left a comment

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.

I think this looks good now. I'm marking for presubmit to see how this behaves in Google.

Comment thread packages/animations/browser/src/util.ts Resolved
Comment thread packages/animations/browser/src/util.ts Resolved
@JoostK JoostK added action: presubmit The PR is in need of a google3 presubmit action: review The PR is still awaiting reviews from at least one requested reviewer and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Jul 4, 2021
@JoostK
JoostK requested review from crisbeto and removed request for alxhub July 4, 2021 19:42
@pullapprove
pullapprove Bot requested a review from alxhub July 4, 2021 19:42
@dario-piotrowicz
dario-piotrowicz requested a review from JoostK July 5, 2021 12:04
@dario-piotrowicz
dario-piotrowicz force-pushed the animations-normalize-toStyles branch 2 times, most recently from 78d47c3 to b9ffddc Compare July 10, 2021 11:20
@dario-piotrowicz

Copy link
Copy Markdown
Contributor Author

@dario-piotrowicz You seem to have amended the last commit, which was the refactor to remove the imports. I think the goal was to create a fixup commit and squash that into the second commit.

lol you noticed that immediately! 🙈

force of habit to amend the last commit... sorry 😅 , should be all good now

@JoostK JoostK added action: review The PR is still awaiting reviews from at least one requested reviewer and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jul 17, 2021
@AndrewKushnir

Copy link
Copy Markdown
Contributor

FYI tests in Google's codebase (including a global run) went well.

// cc @JoostK

@AndrewKushnir AndrewKushnir left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@dario-piotrowicz thanks for the fix 👍
The changes look good, just left 1 minor comment on seemingly unused import.

@AndrewKushnir AndrewKushnir removed the action: review The PR is still awaiting reviews from at least one requested reviewer label Jul 19, 2021
the final styles created in buildStyles lack normalization, meaning that pixel values remain as numbers (without "px") and so such properties fail to be correctly set/applied

Example: "width: 300" is applies as "width": "300" (and thus ignored) instead of the correct "width": "300px"
the buildTrigger function and AnimationTrigger class are annotated
as publicApi which seems wrong and makes changes to the two
problematic, so they are being removed here

see: https://github.com/angular/angular/pull/42763/files#r671481902
in the animation_trigger.ts file there are unused imports
remove them to clean up the file
@dario-piotrowicz
dario-piotrowicz force-pushed the animations-normalize-toStyles branch from cc520c0 to f7e517a Compare July 19, 2021 17:57
@AndrewKushnir

Copy link
Copy Markdown
Contributor

@JoostK @crisbeto could you please have a final look and if everything is ok, we can probably add the PR to the merge queue?

@JoostK JoostK added the action: merge The PR is ready for merge by the caretaker label Jul 19, 2021
@JoostK

JoostK commented Jul 19, 2021

Copy link
Copy Markdown
Member

Let's do it! I was waiting for CI to go green.

@JoostK JoostK added the target: patch This PR is targeted for the next patch release label Jul 19, 2021
@AndrewKushnir AndrewKushnir removed the action: presubmit The PR is in need of a google3 presubmit label Jul 20, 2021
alxhub pushed a commit that referenced this pull request Jul 20, 2021
…2763)

fix the typo "mean't" in the transition_animation_engine spec file
to "meant" (the typo is simply in a code comment so the change
does not have any impact)

PR Close #42763
alxhub pushed a commit that referenced this pull request Jul 20, 2021
the final styles created in buildStyles lack normalization, meaning that pixel values remain as numbers (without "px") and so such properties fail to be correctly set/applied

Example: "width: 300" is applies as "width": "300" (and thus ignored) instead of the correct "width": "300px"

PR Close #42763
alxhub pushed a commit that referenced this pull request Jul 20, 2021
)

the buildTrigger function and AnimationTrigger class are annotated
as publicApi which seems wrong and makes changes to the two
problematic, so they are being removed here

see: https://github.com/angular/angular/pull/42763/files#r671481902

PR Close #42763
alxhub pushed a commit that referenced this pull request Jul 20, 2021
in the animation_trigger.ts file there are unused imports
remove them to clean up the file

PR Close #42763
@alxhub alxhub closed this in 5d7359e Jul 20, 2021
alxhub pushed a commit that referenced this pull request Jul 20, 2021
the final styles created in buildStyles lack normalization, meaning that pixel values remain as numbers (without "px") and so such properties fail to be correctly set/applied

Example: "width: 300" is applies as "width": "300" (and thus ignored) instead of the correct "width": "300px"

PR Close #42763
alxhub pushed a commit that referenced this pull request Jul 20, 2021
)

the buildTrigger function and AnimationTrigger class are annotated
as publicApi which seems wrong and makes changes to the two
problematic, so they are being removed here

see: https://github.com/angular/angular/pull/42763/files#r671481902

PR Close #42763
alxhub pushed a commit that referenced this pull request Jul 20, 2021
in the animation_trigger.ts file there are unused imports
remove them to clean up the file

PR Close #42763
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Aug 20, 2021
@dario-piotrowicz
dario-piotrowicz deleted the animations-normalize-toStyles branch October 23, 2021 11:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: animations legacy animations package only. Otherwise use area: core. cla: yes target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants