Results 1 to 3 of 3

Thread: Modern Toolkit 6.6 Event Handling - How to prevent "tap through"

  1. #1
    Sencha Premium Member
    Join Date
    Jun 2014
    Posts
    72
    Answers
    3

    Default Modern Toolkit 6.6 Event Handling - How to prevent "tap through"

    It is difficult to provide an example of this but here's what is happening:

    The user taps a row in a grid component. A listener for the childtap event calls a handler function defined on the view controller for the grid.

    The handler fires an event which results in the grid view being destroyed and a detail view created. Pretty straightforward so far.

    Oddly enough that childtap event is still propagating even after the grid view has been destroyed and the detail view is created because if the spot at which the user taps on the grid view corresponds to an input field on the detail view, the input field receives focus. Just as if the user had tapped on the input field after tapping the grid row.

    That's obviously not what I want. I want the event to stop after the view controller for my grid handles it. According to the documentation there are various options you can add to the event handling such as 'stopEvent', 'stopPropagation', 'preventDefault'. I've tried all of these and they don't seem to make any difference. Here's an example of what I have tried in terms of the listener configuration:

    Code:
    listeners:{
        childTap:{
            fn:'handleRowTap',
            stopEvent:true
        }
    }
    Back when I was developing with Sencha Touch there was an Ext.event.Event object that was passed to the handler. I could call the stopEvent function of this event object and that prevented the "tap through". Not sure how to handle it now.

  2. #2
    Sencha Premium Member
    Join Date
    Jun 2014
    Posts
    72
    Answers
    3

    Default

    Ok after reading my original post I realize my description was kind of confusing. Here's the simplified version:

    Imagine two views in a card layout. The user taps on the active view, that tap event then propagates through to the second view and when the second view is made active it responds to the event just as if the user had tapped on it. If there happened to be a button on that second view it would respond to the tap event even though the user couldn't even see the button when he tapped the first view.

    That is what is happening. I don't know how to stop it from happening. I only want one view to respond to the tap event.

  3. #3
    Sencha Premium Member
    Join Date
    Jun 2014
    Posts
    72
    Answers
    3

    Default

    Well, I finally solved this myself by delaying the activation of the second view for 500ms so that the tap event can complete bubbling through or whatever it is doing before the second view is shown. This is just flat out a bug in the framework that has been there since the Sencha Touch days and I guess will never get fixed. There is no way that this behavior could be considered "normal". In what application have you ever used is it normal to tap on something and a component in a view that is completely hidden responds to it? There should be a way to stop the event after the initial handler has completed processing it. Instead I have to insert an annoying delay that makes the application look slow so that focus doesn't suddenly move to some random field on the second view that happened to be underneath the location where the user tapped.

Similar Threads

  1. [OPEN] Modern toolkit Grid "hideHeaders" not working inside collapsed panel
    By PetyoKostakov in forum Ext JS 6.x Bugs
    Replies: 6
    Last Post: 6 Jan 2020, 7:19 AM
  2. Replies: 3
    Last Post: 7 Jul 2015, 7:08 AM
  3. Toolkit "modern" not found
    By HorusDev in forum Ext JS 6.x Q&A
    Replies: 1
    Last Post: 7 May 2015, 8:11 AM
  4. how to prevent deleting event if success":"false"
    By chandan15585 in forum Community Discussion
    Replies: 3
    Last Post: 9 Mar 2012, 8:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •