The bug in Polymer 1.0 where a custom element is causing issues when clicking under the toolbar

Issues have arisen with a custom element I created, named

<little-game></little-game>
.
Here is the template code for
<little-game></little-game>
:

<template>
<a href="{{link}}">
<paper-material elevation="1">
  <paper-ripple></paper-ripple>
  <iron-image src="{{img_url}}"></iron-image>
  <div id="description">{{name}}</div>
  <div id="category">{{category}}</div>
</paper-material>
</a></template>

And here is the :host CSS for this element:

:host {
  display: inline-block;
  text-decoration: none;
  z-index:1;
}

The

<little-game></little-game>
elements are displayed on a page along with a
<paper-scroll-header-panel>
and a <paper-toolbar>. The issue arises when scrolling down and the '.tall' <paper-toolbar> becomes smaller, allowing clicks to pass through onto the <little-game>/<paper-ripple> element.

<paper-ripple> CSS:

paper-ripple {
z-index:1;}

Main toolbar HTML:

<paper-toolbar id="mainToolbar" class="tall">
      <paper-icon-button id="paperToggle" icon="menu" paper-drawer-toggle></paper-icon-button>
      <span class="flex"></span>
      <!-- Toolbar icons -->
      <!--paper-icon-button icon="refresh"></paper-icon-button-->
      <paper-icon-button icon="more-vert"></paper-icon-button>
      <!-- Application name -->
      <div class="middle middle-container center horizontal layout">
        <div class="app-name">App title</div>
      </div>
      <!-- Application sub title -->
      <div class="bottom bottom-container center horizontal layout">
        <div class="bottom-title paper-font-subhead">App subtitle</div>
      </div>
    </paper-toolbar>

Main toolbar CSS:

#mainToolbar {
z-index:3;}

The main issue lies in being able to click the
<a href="#"><little-game></little-game></a>
element through the toolbar.


To better understand the scenario, refer to this image:
https://i.sstatic.net/svn0s.png

Answer №1

To prevent the tap event from spreading, consider implementing an on-tap event handler on the paper-toolbar element like this:

<paper-toolbar id="mainToolbar" class="tall" on-tap="{{blockEvent}}">

Then define a function to block it:

blockEvent: function(event) {
  event.stopPropagation();
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Update the content according to the size of the screen

I'm currently working on a project where I need to redirect pages based on screen sizes. I have separate index files for the mobile and web versions of the website. In the web version's index file, I've added the following script: <scri ...

Guide on implementing Observables in Angular 2+ to update a single entry in a table in real-time

I'm facing a challenge with my Angular4 and Node.js application. I have a table that displays data with 7 columns using *ngFor. The issue arises when I need to update the last column dynamically and in real-time. Specifically, I want to show a green c ...

Guide on navigating to a specific page with ngx-bootstrap pagination

Is there a way to navigate to a specific page using ngx-bootstrap pagination by entering the page number into an input field? Check out this code snippet: ***Template:*** <div class="row"> <div class="col-xs-12 col-12"> ...

Combining two Angular expressions

I have two values to work with: {{columns.field}} and {{resultado.!!!}}. The challenge is that I need to include the value of {{columns.field}} inside the !!!, but I'm struggling to figure out how. I have to structure it this way because I am unsure o ...

Vue 3's Paged.js does not respond to requests for page breaks

Currently, I'm working on implementing page breaks in Vue.js 3. Despite my efforts and utilization of the specified CSS code, I am facing challenges with the ".page-break" class parameter. While I can successfully modify other elements like titlePage ...

Is there a way to incorporate an 'ended' feature into the .animate() function?

I'm currently working on a jQuery statement where I want to activate pointer events once the button animation is finished. However, I'm unsure how to incorporate an ended or complete function. Any suggestions on how to approach this? $('#ce ...

What is the best way to eliminate the space between two paragraphs?

Check out my awesome image! I need some help with formatting HTML data into text. Can anyone advise me on how to eliminate the space between two paragraphs? func processGetDescriptionResponse(json: JSON) { let status = json.dictionaryObject!["statu ...

How can you create an accordion menu that expands when a button is clicked?

Is there a way to make an accordion menu open when the 'More' button is clicked? I've tried, but it always starts in its expanded state and collapses when the button is clicked. What I really want is for the accordion to be closed initially ...

The dimensions of the HTML table have expanded excessively following the execution of mysql_fetch_assoc

I have encountered an issue where, after inserting the database values into an HTML table, the table becomes too large. I've tried using CSS code to adjust it, but it doesn't help. Should I consider changing something in the database value type? ...

Retrieve the most recent information from the database based on a specific column

Is there a way to retrieve only the most recent row from each category in the database? Example Database: Table name: Colors id category timestamp 1 yellow 14/2/2014 2 blue 13/2/2014 3 red 14/2/2014 4 yellow 13/2/2014 5 blue 11/2/2014 ...

The Datalist feature in HTML5 offers an auto-suggest functionality that displays a list of options beginning with the

In my project, I am utilizing HTML5 Datalist for autosuggestion. By default, HTML5 follows the keyword contains approach rather than the starts with approach. For example, if my datalist includes one, two, three and I type "o" in the search box, it displ ...

Request for "/media/img/image.png" was made using HTTP/1.1 but ended in a 404 error with a response size

Upon loading the page, there seems to be an issue with the image not appearing. The image was uploaded using Django-admin. Below is the section of the HTML template responsible for loading the image: Home.html <img class="card-img-top" src=&q ...

Tips for accessing the value stored within the parent element

As someone who is new to the world of javascript and typescript, I am currently working on an ionic application that involves fetching a list of values from a database. These values are then stored in an array, which is used to dynamically create ion-items ...

Unable to retrieve table information from HTML source code using Python and Selenium

In my endeavor to gather the odds data from this particular source, I am specifically focused on the "Over Under" segment and the over/under odds provided by Pinnacle and AsianOdds, which are accessible through the "compare" button. Here is an image descr ...

JavaScript causing values to disappear when the page refreshes

When a user hovers over ImageButtons, I use Javascript to change the ImageUrl. However, on submitting the form, the updated ImageUrl property is not reflected in the code behind. Similarly, I also dynamically update a span tag using Javascript, but its alt ...

trouble with react-table's default height and flexible design

I am facing an issue with my React table configuration. I have set up scrollable columns and header following a similar example here: https://codesandbox.io/s/kowzlm5jp7?file=/index.js:281-310 In the table styles, I have specified a height like this: ...

Inline CSS alignment

While experimenting with layout inline elements, I came across some unusual behavior. Can someone please explain why there is a difference? I have applied the following CSS to both HTML structures: .time { position: relative; top:100px; heigh ...

Bootstrap responsive breakpoints for different sizes

As I was optimizing my webpage, everything was going smoothly until I had the idea to incorporate the srcset and sizes attributes into my <img> tags. I developed a php function that generates an img object and populates the srcset attribute with newl ...

The JSX element 'body' appears to be missing its closing tag

I'm currently in the process of developing a landing page using react.js. This particular page is designed for users who are not yet signed up to create an account if they wish to do so. Unfortunately, I'm encountering some errors, one of which p ...

Switching CSS styles - seeking a smoother integration

I have successfully implemented a JS CSS switcher, which works brilliantly. However, I would like it to function more seamlessly. When opening a new page on the site, the default CSS style sometimes flickers briefly before the selected CSS style is reappli ...