Skip to content

Commit c4cb6b4

Browse files
committed
Fixed scroll offset when tabs are brought into view
1 parent 35210f5 commit c4cb6b4

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

material/assets/javascripts/bundle.0f659f14.min.js renamed to material/assets/javascripts/bundle.7f366e99.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

material/assets/javascripts/bundle.0f659f14.min.js.map renamed to material/assets/javascripts/bundle.7f366e99.min.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

material/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@
216216
</script>
217217
{% endblock %}
218218
{% block scripts %}
219-
<script src="{{ 'assets/javascripts/bundle.0f659f14.min.js' | url }}"></script>
219+
<script src="{{ 'assets/javascripts/bundle.7f366e99.min.js' | url }}"></script>
220220
{% for path in config["extra_javascript"] %}
221221
<script src="{{ path | url }}"></script>
222222
{% endfor %}

src/assets/javascripts/components/content/tabs/index.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,14 @@ export function mountContentTabs(
140140

141141
/* Scroll container to active content tab */
142142
const content = getElementContentOffset(container)
143-
if (offset.x < content.x)
144-
prev.click()
145-
else if (offset.x + width > content.x + size.width)
146-
next.click()
143+
if (
144+
offset.x < content.x ||
145+
offset.x + width > content.x + size.width
146+
)
147+
container.scrollTo({
148+
left: Math.max(0, offset.x - 16),
149+
behavior: "smooth"
150+
})
147151
},
148152

149153
/* Handle complete */

0 commit comments

Comments
 (0)