Coder Social home page Coder Social logo

Comments (12)

mirari avatar mirari commented on June 3, 2024

Do you mean the act of pressing esc to exit fullscreen? This is controlled by the browser.
Only the pageOnly option that is automatically enabled when the browser does not support the fullscreen api simulates this action.

from vue-fullscreen.

Enoooch avatar Enoooch commented on June 3, 2024

Yes, when pageOnly is enabled.

Sorry for not making it clear.

from vue-fullscreen.

mirari avatar mirari commented on June 3, 2024

I would like to know what the exact behavior of the conflict is like. The binding and unbinding of event listeners are both passed specific function, they shouldn't affect other listener behavior.

const keypressCallback = (e) => {
  if (e.key === 'Escape') {
    document.removeEventListener('keyup', keypressCallback)
    this.exit()
  }
}
document.removeEventListener('keyup', keypressCallback)
document.addEventListener('keyup', keypressCallback)

from vue-fullscreen.

Enoooch avatar Enoooch commented on June 3, 2024

If I also have a dialog with [Escape] key binding inside this fullscreen content.

from vue-fullscreen.

mirari avatar mirari commented on June 3, 2024

If you don't use pageOnly, this event listener may also trigger the browser to exit the fullscreen, maybe you can use e.stopPropagation to stop the event from bubbling.

from vue-fullscreen.

Enoooch avatar Enoooch commented on June 3, 2024

In my case, I may have other teleport content such as el-dialog which also enable key escape to close dialog.
And that's the conflict is.

So, I would rather pass a prop to disable esc event listeners, and add a button to call exit manually.

<fullscreen ref="contextRef" v-model="isFullscreen" :teleport="true" :page-only="true" :close-on-press-escape="false">
  <button @click="() => contextRef.exit()" />
  ......
</fullscreen>

from vue-fullscreen.

mirari avatar mirari commented on June 3, 2024

If you don't use pageOnly, does the full screen exit when you press Esc button in a dialog?
Adding such an option would become confusing and difficult to describe, since it doesn't actually prevent the browser from acting by default.

from vue-fullscreen.

Enoooch avatar Enoooch commented on June 3, 2024

Whether by setting pageOnly or not, it always exit when press Esc in a dialog.

from vue-fullscreen.

mirari avatar mirari commented on June 3, 2024

So adding this option doesn't completely solve the problem, because the browser's behavior can't be prevented.

from vue-fullscreen.

Enoooch avatar Enoooch commented on June 3, 2024

Yeah, I'm aware of that we can't change the behavior in browser's fullscreen, but we can control it when pageOnly is enabled.

This feature only needed in rare cases. But it still conflict with other components that has Escape key bindings.

Thanks for responding, if there is still a no go, I will close this issue.

from vue-fullscreen.

mirari avatar mirari commented on June 3, 2024

You can use this to avoid triggering the listener event on the document.

document.addEventListener("keyup", (e) => {
  if (e.key === "Escape") {
    e.stopImmediatePropagation();
  }
});

from vue-fullscreen.

Enoooch avatar Enoooch commented on June 3, 2024

Thanks, I will apply this instead.

from vue-fullscreen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.