Comments (7)
A quick-fix is to ignore certain events (like "space") when the egui viewport doesn't have focus (ctx.input(|i| i.focused)
), but that's assuming focused
is correctly set (which I'm not sure it is).
from rerun.
From slack discussion: we should consider moving the keydown
event handler from document
to canvas
here:
If we do we need to make sure that the canvas gets automatic focus (e.g. on egui.rs and rerui.io/viewer).
In general, any events that can be moved from document
to canvas
without loss of functionality should be moved in order to better support multiple eframe viewports in the same web view.
Some events, like keyup
, should probably stay on document
so that we don't miss a key release on e.g. (alt-)tab or similar.
For the events that are installed on document
:
- check for focus in any document/window events before doing anything, especially
preventDefault/stopPropagation
from rerun.
In order for the canvas element to be able to accept focus, it also needs to have a tabIndex="0"
attribute set. The 0
ensures that the canvas follows the focus order defined by the order in the document source.
from rerun.
We decided to do a quick-fix for this for now:
Ignore some key presses (space, arrow keys) in Rerun on web if mouse cursor isn't inside the viewer canvas. @jleibs is taking the lead on this.
from rerun.
Playing around with this the proposed solution still feels quite awkward.
In particular, it becomes evident that keyboard shortcuts are broken in other ways. Events sent while the viewer is in focus still also get processed by the notebook. For example hitting "space" triggers a page-down.
from rerun.
I realized this is in fact a regression, which is why nobody has complained. This is one of the things we were getting "for free" from the fact that the viewer was previously embedded in an iframe.
from rerun.
Additional notes:
- emilk/egui#4718 addresses the main issue
There is a second regression which is that jupyter notebook (classic) sometimes responds to Rerun events. In particular, the "a" key when trying to navigate.
I believe this can be traced back to jupyter's keyboard manage itself being somewhat poorly behaved:
https://github.com/jupyter/nbclassic/blob/main/nbclassic/static/notebook/js/keyboardmanager.js#L175-L183
It might be possible for us to detect when we have focus and manually disable the jupyter keybooard manager: https://github.com/jupyter/notebook/blob/ca50f1af5afb525fd95b98b2e61e69db28094467/notebook/static/notebook/js/keyboardmanager.js#L234
This is not an issue in jupyterlab, which appears to follow better practices for event handling.
from rerun.
Related Issues (20)
- Replace VisualizerOverrides boolean indicator components HOT 1
- Scrollable containers
- Spurious error message when using `multiprocessing `: "Fork detected during set_sink"
- `egui_plot`: looking for maintainer HOT 1
- Slider drag box is drawn over list item's action button
- Add `DragValue::only_clamp_on_input` to egui and use it for all drag values in edit ui
- Viewer instances don't release memory when cell output is cleared HOT 5
- Rerun widget output allways ends up creating a scroll area
- The new self-contained widget is slow in google colab HOT 1
- Remove weekly alpha
- Selection panel touch-up HOT 1
- disabled color picker displays color incorrectly
- Image connected to a pinhole camera is not being shown in the space view.
- Refactor component ui registry to unify edit ui & display ui
- Python enums don't implement component interface
- Better handle large value UI in `PropertyContent`
- Support full entity-path-expressions for overrides
- C++ Transform3D() archetype constructor should match rust Transform3D::IDENTITY HOT 1
- Sending a blueprint withan empty barchart crashes the viewer HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rerun.