Commit a6cd3092 authored by Michael Hansen's avatar Michael Hansen Committed by Chromium LUCI CQ

[Nearby] Fix unwanted toggle animation.

If we launch the settings app by navigating to the Nearby Share subpage,
the "enabled" toggle can be seen animating from the off to the on state.
This is because prefs are not bound until after the page is visible.
Other elements also appear or update after the page loads, but this
toggle is especially noticeable because of the animation. This fix wraps
the toggle in a template so that it appears in the correct state after
prefs have been bound.

Fixed: 1158520
Change-Id: Ifbc753ca3faf6db65bba183621c861bc716c6746
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2602576Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Michael Hansen <hansenmichael@google.com>
Cr-Commit-Position: refs/heads/master@{#841163}
parent b793d981
......@@ -66,10 +66,16 @@
[[getOnOffString_(prefs.nearby_sharing.enabled.value,
'$i18nPolymer{deviceOn}', '$i18nPolymer{deviceOff}')]]
</div>
<settings-toggle-button id="featureToggleButton" aria-describedby="onOff"
pref="{{prefs.nearby_sharing.enabled}}"
deep-link-focus-id$="[[Setting.kNearbyShareOnOff]]">
</settings-toggle-button>
<!-- Use a template to work around visual glitch where the toggle flips
on when the page first loads. -->
<template is="dom-if" if="[[prefs]]" restamp>
<settings-toggle-button id="featureToggleButton"
aria-describedby="onOff"
pref="{{prefs.nearby_sharing.enabled}}"
deep-link-focus-id$="[[Setting.kNearbyShareOnOff]]">
</settings-toggle-button>
</template>
</div>
<div class="settings-box two-line">
<div class="start"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment