Keyboard orientation and media query bug (app mode)

前端 未结 3 1138
礼貌的吻别
礼貌的吻别 2021-01-20 04:13
  1. Add this webpage to your iOS7 home screen
  2. Open it, and focus the input field (the keyboard pops up)
  3. The text turns red, as the phone thinks it is in
3条回答
  •  旧巷少年郎
    2021-01-20 04:29

    This is clearly an iOS7 bug. In my application I found that I can reliably distinguish portrait mode from landscape mode even when focused on an input field with the on screen keyboard open using this media query:

    @media only screen and (device-width: 768px) and (device-height: 1024px) and 
        (min-aspect-ratio: 4/3) {
      /* landscape differences here */
    }
    

    I couldn't use orientation: landscape because the rule would get activated even in portrait mode if the keyboard is open.

    I probably need a different rule for the iPhone but I haven't gotten that far yet.

提交回复
热议问题