Skip to content

Commit 23bcabe

Browse files
committed
merge: hotfix-9.11.4 into master
2 parents 9c30817 + e712a8f commit 23bcabe

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## [Unreleased]
44

5+
## [9.11.4] – 2025-09-29
6+
7+
### Fixed
8+
9+
- Avoid scrolling whole page when scrolling to match column
10+
511
## [9.11.3] – 2025-09-25
612

713
### Fixed
@@ -551,6 +557,7 @@
551557
- Lots of bug fixes for the sidebar
552558

553559
[unreleased]: https://github.com/spraakbanken/korp-frontend/compare/master...dev
560+
[9.11.4]: https://github.com/spraakbanken/korp-frontend/releases/tag/v9.11.4
554561
[9.11.3]: https://github.com/spraakbanken/korp-frontend/releases/tag/v9.11.3
555562
[9.11.2]: https://github.com/spraakbanken/korp-frontend/releases/tag/v9.11.2
556563
[9.11.1]: https://github.com/spraakbanken/korp-frontend/releases/tag/v9.11.1

app/markup/about.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="modal-header">
2-
<h2>Korp version 9.11.3</h2>
2+
<h2>Korp version 9.11.4</h2>
33
<span ng-click="clickX()" class="close-x">×</span>
44
</div>
55

app/scripts/components/kwic/kwic.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ angular.module("korpApp").component("kwic", {
145145
page-change="$ctrl.pageEvent(page)"
146146
hits-per-page="$ctrl.hitsPerPage"
147147
></kwic-pager>
148-
<div class="table_scrollarea" dir="{{ dir }}">
149-
<table class="results_table kwic" ng-if="!$ctrl.useContext" cellspacing="0">
148+
<div class="table_scrollarea">
149+
<table class="results_table kwic" ng-if="!$ctrl.useContext" cellspacing="0" dir="{{ dir }}">
150150
<tr
151151
class="sentence"
152152
ng-repeat="sentence in $ctrl.kwic"
@@ -197,7 +197,7 @@ angular.module("korpApp").component("kwic", {
197197
</td>
198198
</tr>
199199
</table>
200-
<div class="results_table reading" ng-if="$ctrl.useContext">
200+
<div class="results_table reading" ng-if="$ctrl.useContext" dir="{{ dir }}">
201201
<p
202202
class="sentence"
203203
ng-repeat="sentence in $ctrl.kwic"
@@ -301,8 +301,8 @@ angular.module("korpApp").component("kwic", {
301301
$ctrl.useContext = $ctrl.context || !store.in_order
302302
if (!$ctrl.context) {
303303
$timeout(() => {
304+
$element.find(".match .word").first().trigger("click")
304305
centerScrollbar()
305-
$element.find(".match").children().first().click()
306306
})
307307
}
308308

@@ -552,9 +552,16 @@ angular.module("korpApp").component("kwic", {
552552

553553
/** Scroll KWIC container to center the match column. */
554554
function centerScrollbar() {
555-
// Type assertion needed because `container` is non-standard.
556-
const options = { block: "nearest", inline: "center", container: "nearest" } as ScrollIntoViewOptions
557-
$element.find(".match").get(0)?.scrollIntoView(options)
555+
const area = $element.get(0)?.querySelector(".table_scrollarea")
556+
const match = area?.querySelector(".match")
557+
if (!area || !match) return
558+
const matchBox = match.getBoundingClientRect()
559+
const areaBox = area.getBoundingClientRect()
560+
const scrollLeft = area.scrollLeft + matchBox.left + matchBox.width / 2 - areaBox.width / 2
561+
// After setting `.scrollLeft`, it corrects itself to a value within range,
562+
// so this works also with RTL where `scrollLeft` is negative in some browsers.
563+
area.scrollLeft = -1e10
564+
area.scrollLeft += scrollLeft
558565
}
559566

560567
/** Add offsets to align each linked sentence with its main one */

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "korp-frontend",
3-
"version": "9.11.3",
3+
"version": "9.11.4",
44
"dependencies": {
55
"@fontsource/source-sans-pro": "^5.1.0",
66
"@fortawesome/fontawesome-free": "6.2.1",

0 commit comments

Comments
 (0)