Skip to content

Commit

Permalink
Hopefully a final solution for the soft keyboard in iOS. (#134)
Browse files Browse the repository at this point in the history
We manually set the gameport height in input blur/focus event handlers. Then when the visualViewport:resize event arrives later on, it should ideally be already the same height, or else very close to it.
I discovered that iOS actually sends 3 resize events on focus, for the keyboard being up, then down, then up again. So I throttle the resize handler in iOS.
Use the body-scroll-lock package to handle scrolling in iOS, letting me remove a bunch of old scrolling code. Note that the body and html elements need `height: 100%; width: 100%` CSS to be applied.
The TextInput.refocus() function was being called multiple times when the soft keyboard changed. Prevent it from being called more than once after each turn.
  • Loading branch information
curiousdannii committed Oct 27, 2024
1 parent 18df014 commit 9411ea2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ Building Instructions

Parchment is only designed for building in Linux and may not work in other OSes. You'll need to install Git and Node version >= 16.

The upstream projects are included as git submodules. Start by initializing the submodules:
The upstream projects are included as Git submodules. Start by cloning the Git repository:

```
git submodule update --init --recursive
git clone --recurse-submodules https://github.com/curiousdannii/parchment.git
cd parchment
```

Then install the `npm` dependencies:
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"type": "module",
"dependencies": {
"base32768": "^3.0.1",
"body-scroll-lock": "^4.0.0-beta.0",
"emglken": "^0.6.0",
"fflate": "^0.8.1",
"file-saver": "^2.0.5",
Expand All @@ -25,6 +26,7 @@
"pretty-bytes": "^6.1.1"
},
"devDependencies": {
"@types/body-scroll-lock": "^3.1.2",
"@types/file-saver": "^2.0.7",
"@types/jquery": "^3.5.11",
"@types/js-cookie": "^3.0.4",
Expand Down
5 changes: 5 additions & 0 deletions src/web/parchment.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ https://github.com/curiousdannii/parchment
*/

body, html {
height: 100%;
width: 100%;
}

body {
background: var(--glkote-page-bg);
color: var(--glkote-buffer-fg);
Expand Down

0 comments on commit 9411ea2

Please sign in to comment.