DEV: Replace onClick props in topic-timeline container (#28342)

Use `on` modifier instead, and set proper href attributes on links
This commit is contained in:
Jarek Radosz 2024-08-13 18:38:07 +02:00 committed by GitHub
parent 1e3caeafa0
commit 82741eb0a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 10 deletions

View File

@ -2,9 +2,9 @@
<div class="title">
<h2>
<a
class="fancy-title"
href
{{on "click" @jumpTop}}
href={{@model.firstPostUrl}}
class="fancy-title"
>{{this.topicTitle}}</a>
</h2>
{{#if (or this.siteSettings.topic_featured_link_enabled this.showTags)}}
@ -72,9 +72,10 @@
<div class="timeline-scrollarea-wrapper">
<div class="timeline-date-wrapper">
<a
class="start-date"
onClick={{this.updatePercentage}}
{{on "click" this.updatePercentage}}
href={{@model.firstPostUrl}}
title={{i18n "topic_entrance.jump_top_button_title"}}
class="start-date"
>
<span>
{{this.startDate}}
@ -87,9 +88,10 @@
{{did-insert this.registerScrollarea}}
>
<div
class="timeline-padding"
{{! template-lint-disable no-invalid-interactive }}
{{on "click" this.updatePercentage}}
style={{this.beforePadding}}
onClick={{this.updatePercentage}}
class="timeline-padding"
></div>
<TopicTimeline::Scroller
@current={{this.current}}
@ -104,9 +106,10 @@
{{did-insert this.registerScroller}}
/>
<div
class="timeline-padding"
{{! template-lint-disable no-invalid-interactive }}
{{on "click" this.updatePercentage}}
style={{this.afterPadding}}
onClick={{this.updatePercentage}}
class="timeline-padding"
></div>
{{#if (and this.hasBackPosition this.showButton)}}
@ -118,7 +121,11 @@
</div>
<div class="timeline-date-wrapper">
<a class="now-date" onClick={{this.updatePercentage}}>
<a
{{on "click" this.updatePercentage}}
href={{@model.lastPostUrl}}
class="now-date"
>
<span>
{{age-with-tooltip this.nowDate this.nowDateOptions}}
</span>

View File

@ -308,8 +308,10 @@ export default class TopicTimelineScrollArea extends Component {
});
}
@bind
@action
updatePercentage(e) {
e.preventDefault();
const currentCursorY = e.pageY || e.touches[0].pageY;
const desiredScrollerCentre = currentCursorY - this.dragOffset;