Oops,

On 2021/03/10 17:11, Masayuki Nakano wrote:
Example 1:
```
addEventListener("wheel", event => {
  let amount = event.deltaY;
  if (isFirefox) {
    amount *= 16;
  }
  scroll(amount);
  event.preventDefault();
});
```

Example 2:
```
addEventListener("wheel", event => {
  let amount = event.deltaY;
  if (isFirefox && navigator.platform.includes("Mac")) {
    amount *= 16;
  }
  scroll(amount);
  event.preventDefault();
});
```

These cases are what they will be broken with current hack.

Example 3:
```
addEventListener("wheel", event => {
  const amount =
    event.deltaY > 0
      ? Math.min(event.deltaY, 16)
      : Math.max(event.deltaY, -16);
  scroll(amount);
  event.preventDefault();
});
```

And this must be better, but may keep broken if user users high-resolution wheel on Windows (and maybe on Linux?).

So, in most broken web apps, current hack must work as expected because `deltaMode` is not referred.

So, the case which will be fixed by the hack is:

```
addEventListener("wheel", event => {
  scroll(event.deltaY);
  event.preventDefault();
});
```

--
Masayuki Nakano <masay...@d-toybox.com>
Working on DOM, Events, editor and IME handling for Gecko
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to