Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8490967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:16:46+00:00 2026-06-10T22:16:46+00:00

I am using reveal.js by Hakim El Hattab to make presentation slides. I have

  • 0

I am using reveal.js by Hakim El Hattab to make presentation slides. I have added textarea to a slide. Within the textarea I want to prevent javascript functions from being called when certain keys are pressed, and restore the default behavior of typing. For example, as you can see from the lines of code below from reveal.js, when p is pressed, a function navigatePrev() is called. I want to prevent this function from being called and simply want p to be typed in the textarea when p is pressed. How can I do this using jquery? I tried adding the following script but that does not help.

<script>
  $(document).keydown(function (e) {
    if ($(e.target).is('textarea')) {
      e.stopPropagation();
    }
  })
</script>

The functions defined in the reveal.js are still called. Using return false in place of e.stopPropagation() does not help either. I am also including the above jQuery lines at the very end on my page (after reveal.js is called).

Thank you.

Relevant lines from reveal.js

function onDocumentKeyDown(event) {
  // FFT: Use document.querySelector( ':focus' ) === null 
  // instead of checking contentEditable?

  // Disregard the event if the target is editable or a 
  // modifier is present
  if (event.target.contentEditable != 'inherit' || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return;

  var triggered = false;

  switch (event.keyCode) {
    // p, page up
    case 80: case 33: navigatePrev(); triggered = true; break;
    // n, page down
    case 78: case 34: navigateNext(); triggered = true; break;
    // h, left
    case 72: case 37: navigateLeft(); triggered = true; break;
    // l, right
    case 76: case 39: navigateRight(); triggered = true; break;
    // k, up
    case 75: case 38: navigateUp(); triggered = true; break;
    // j, down
    case 74: case 40: navigateDown(); triggered = true; break;
    // home
    case 36: navigateTo(0); triggered = true; break;
    // end
    case 35: navigateTo(Number.MAX_VALUE); triggered = true; break;
    // space
    case 32: overviewIsActive() ? deactivateOverview() : navigateNext(); triggered = true; break;
    // return
    case 13: if (overviewIsActive()) { deactivateOverview(); triggered = true; } break;
  }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T22:16:48+00:00Added an answer on June 10, 2026 at 10:16 pm

    The problem with your keydown event binding is that it binds to the document, which receives the event LAST (once it’s too late to prevent the event from bubbling further up the DOM tree).

    Instead, try binding the event directly to the textarea every time it is created:

    // create text area & append to slide container
    createTextAreaOnSlideContainer();
    
    // bind an event handler to the element
    $('textarea.slideTextArea').keydown( function(e) {
        e.stopPropagation();
    });
    

    This will stop the event before it bubbles (propagates) up to the document that is listening for a key to be pressed

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using css to hide content that I want to reveal when a person
is there a simple way to reveal text within a webpage using a link
I'm using cakephp to build a survey and want to use javascript (specifically jquery
I'm using this plugin to show lightbox on a website http://www.zurb.com/playground/reveal-modal-plugin I want to
I have this code which I'm using to reveal the Answers to some questions
I'm using Zurb's Reveal to display modal windows on a webpage. I have to
Using a populated Table Type as the source for a TSQL-Merge. I want to
I'm trying to do a simple show/hide transition for a message div using fx.reveal
I have a project using StoryBoards and UISearchDisplayController used in the context of a
I'm trying to get a 100% width table to slide over to reveal a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.