Skip to content

Commit 1028577

Browse files
authored
fix(scroll): acidental scroll to top on iOS devices (#2695)
* fix scroll on ios typing * Update tsconfig.json * Update CHANGELOG.md * Update CHANGELOG.md * Update package.json * Fix popover hide method to use isHidden flag
1 parent 8442726 commit 1028577

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

docs/CHANGELOG.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
# Changelog
22

3-
### 2.30.1
3+
### 2.30.0
44

55
`New` – Block Tunes now supports nesting items
66
`New` – Block Tunes now supports separator items
77
`New` – "Convert to" control is now also available in Block Tunes
8-
9-
### 2.30.0
10-
118
- `Improvement` — The ability to merge blocks of different types (if both tools provide the conversionConfig)
129
- `Fix``onChange` will be called when removing the entire text within a descendant element of a block.
1310
- `Fix` - Unexpected new line on Enter press with selected block without caret
1411
- `Fix` - Search input autofocus loosing after Block Tunes opening
1512
- `Fix` - Block removing while Enter press on Block Tunes
13+
`Fix` – Unwanted scroll on first typing on iOS devices
1614

1715
### 2.29.1
1816

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@editorjs/editorjs",
3-
"version": "2.30.0-rc.5",
3+
"version": "2.30.0-rc.6",
44
"description": "Editor.js — Native JS, based on API and Open Source",
55
"main": "dist/editorjs.umd.js",
66
"module": "dist/editorjs.mjs",

src/components/utils/popover/popover-mobile.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ export class PopoverMobile extends PopoverAbstract<PopoverMobileNodes> {
3030
*/
3131
private history = new PopoverStatesHistory();
3232

33+
/**
34+
* Flag that indicates if popover is hidden
35+
*/
36+
private isHidden = true;
37+
3338
/**
3439
* Construct the instance
3540
*
@@ -58,18 +63,26 @@ export class PopoverMobile extends PopoverAbstract<PopoverMobileNodes> {
5863
super.show();
5964

6065
this.scrollLocker.lock();
66+
67+
this.isHidden = false;
6168
}
6269

6370
/**
6471
* Closes popover
6572
*/
6673
public hide(): void {
74+
if (this.isHidden) {
75+
return;
76+
}
77+
6778
super.hide();
6879
this.nodes.overlay.classList.add(css.overlayHidden);
6980

7081
this.scrollLocker.unlock();
7182

7283
this.history.reset();
84+
85+
this.isHidden = true;
7386
}
7487

7588
/**

src/components/utils/scroll-locker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default class ScrollLocker {
1515
/**
1616
* Stores scroll position, used for hard scroll lock
1717
*/
18-
private scrollPosition: null|number;
18+
private scrollPosition: null | number = null;
1919

2020
/**
2121
* Locks body element scroll

0 commit comments

Comments
 (0)