question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement better heuristic to enable user interactions than basic focus

See original GitHub issue

As of #288 , we began blocking user interaction unless a <model-viewer> has focus. This enables users to interact with the page in more natural ways (such as scrolling while passing over <model-viewer>) at the cost of requiring explicit interaction to focus <model-viewer> before the controls would work.

@mrdoob immediately pointed out that this was not very intuitive when interacting, especially on mobile. @yuinchien also pointed out the same, and has prototyped some potential alternative heuristics to decide if <model-viewer> should be interactive.

This issue covers discussion and work necessary to enable improved detection of explicit user interactions with <model-viewer> so that it feels intuitive without disrupting other activities such as scrolling the page.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
yuinchiencommented, Apr 8, 2019

I played with horizontal gesture detection on <model-viewer>, as @cdata pointed out, most of the mobile page scroll is vertical, allowing auto-focus to happen when detecting user interaction feels a lot more accessible.

const modelViewer = $('#demo-1');
let startX;
let startY;
let isFocused = false;
const THRESHOLD_X = 30;

function onTouchStart(e) {
  let touchobj = e.changedTouches[0];
  startX = touchobj.pageX;
  startY = touchobj.pageY;
}

function onTouchMove(e) {
  let touchobj = e.changedTouches[0];
  if( Math.abs(touchobj.pageX-startX)>THRESHOLD_X && !isFocused) {
      modelViewer.focus();
  }
}

function onFocus() {
  isFocused = true;
}
function onBlur() {
  isFocused = false;
}

modelViewer.addEventListener("focus", onFocus);
modelViewer.addEventListener("blur", onBlur);
modelViewer.addEventListener("touchstart", onTouchStart, false);
modelViewer.addEventListener("touchmove", onTouchMove, false);
1reaction
elalishcommented, May 8, 2019

One possible solution would be to route touch events to the model regardless of focus, but to reroute those events back to the page when the model limits are hit (high/low elevation, near/far zoom) so that the page can still be scrolled and pinched. The downside is that it would have a bit of sudden mode shift, but it seems fairly consistent with the way scrolling works on pages with scrollable sub-elements. What does our resident expert think @yuinchien?

Read more comments on GitHub >

github_iconTop Results From Across the Web

10 Usability Heuristics for User Interface Design
The design should speak the users' language. Use words, phrases, and concepts familiar to the user, rather than internal jargon. Follow real- ...
Read more >
Heuristic Evaluation: How to Conduct a Heuristic Evaluation
Heuristic evaluation is the activity of using a set of guidelines (heuristics) to evaluate if an interface is user-friendly.
Read more >
Heuristic Analysis for UX: How to Run a Usability Evaluation
A heuristic analysis is used to identify a product's common usability issues so that the problems can be resolved, consequently improving the user's...
Read more >
Usability Heuristics For Bots | Kevin Scott
Visibility of System Status & Recognition rather than recall— Great job using structured messages to guide a user through the interaction.
Read more >
Nielsen's Heuristics: 10 Usability Principles To Improve UI ...
To work with UI means finding ways to develop interactions that allow the user to have a better experience. The UI can not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found