Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

140
Views
Svelte prevent user input on mapbox

I am attempting to block user input when cssDisableUserInput is true.

So basically within my main tags I have this:

<div id=userinput disabled={cssDisableUserinput}>
    <div id="map">
</div>

within my CSS I have:

<style>
  #map {
    width: 1300px;
    height: 800px;  
  }
  #userinput{
    width: 1300px;
    height: 800px; 
    pointer-events: none;
  }
</style>

And yet it completely blocks user input even when cssDisableUserinput is false.

What is a better approach to blocking user input?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The thing that prevents interaction is pointer-events: none;, not disabled. You cannot disable a div. You might want to extract that property into a separate class and apply that conditionally using your cssDisableUserinput flag.

<div class:disable-events={cssDisableUserinput}>...</div>

<style>
  .disable-events { pointer-events: none; }
</style>

(I do not know the Mapbox API, maybe there is a built-in mechanism that would be better suited for achieving this. The above approach may still allow interaction via the keyboard.)

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!