Well, it was only a question of time till one of my clients request better support for bigscreen touch devices such as iPad or some of these new Android tablets.
Have you every tried activescaffold with an iPad? Close Icon is too small, hover is nt supported, record actionlinks are not optimized for touch input…

We are facing at least two issues:

  1. We have to detect touch devices and apply improved css
  2. For some of these devices we have to fix hover issue

Activescaffold uses a new before_filter to identify touch devices, currently it just supports apple devices, but it can be easily overwritten:

def check_input_device
  if request.env["HTTP_USER_AGENT"] && request.env["HTTP_USER_AGENT"][/(iPhone|iPod|iPad)/i]
    session[:input_device_type] = 'TOUCH'
    session[:hover_supported] = false
  else
    session[:input_device_type] = 'MOUSE'
    session[:hover_supported] = true
  end if session[:input_device_type].nil?
end

In addition two new helper methods are provided:

def touch_device?
  session[:input_device_type] == 'TOUCH'
end

def hover_via_click?
  session[:hover_supported] == false
end

And finally we added a new html class “as_touch” to activescaffold’s main div element to be able to apply different css stylings in case of a touch device.

At the end we improved activescaffold’s touchability a lot, it s not perfect but far better than before.

Hope that helps, wish you all a great weekend.

About these ads