Android Webkit: Absolutely positioned elements don't respect z-index

后端 未结 8 986
星月不相逢
星月不相逢 2020-12-23 21:55

Nasty little bug, this one.

As illustrated in Android ticket 6721, the Android browser seems to not respect z-index when absolutely positioned elements are laid over

8条回答
  •  醉话见心
    2020-12-23 22:27

    To answer the question properly it's important to read the bug page. The problem is not about visibility of the input below, but its "clickability".

    I can't test it, but these are possible workarounds:

    0 Forget absolute positioning and just put two divs there and toggle visibility.

    If this doesn't satisfy You...

    1 try setting CSS position to absolute or relative for all a and input tags (Yup, this might force You to rewrite CSS to keep the layout, but isn't it worth it?)

    2 make a -tag container:

     
    

    This will need some more CSS to make the content look ok. But I expect something like this would solve the problem.

    if 1 and 2 aren't helping try them both at once ;)

    3 if it still happens You might want to check in details what happens when You click. Bind click and mousedown events to: link on top, container on top, input in the bottom and log them. If You get any of those events for the top link You can try and stop the bubbling at some moment or prevent the event on the input in the bottom.

    This would be difficult, but I can help a bit. jQuery would be quite necessary.

提交回复
热议问题