jamonholmgren / ProMotion

ProMotion is a RubyMotion gem that makes iPhone development less like Objective-C and more like Ruby.
MIT License
1.26k stars 148 forks source link

editing_style: :none not working properly with VoiceOver #653

Open jamonholmgren opened 9 years ago

jamonholmgren commented 9 years ago

Per @austinseraphin's tweet: https://twitter.com/AustinSeraphin/status/582650809772568576

In table_data I specify editing_style: :none but VoiceOver still says Swipe to delete. What have I missed? VoiceOver offers the delete action on PM’s table screen cells by default.

austinseraphin commented 9 years ago

The problem happens because of the existence of the tableView:commitEditingStyle:forRowAtIndexPath: method. As long as it exists VoiceOver will falsely report the cell as deletable. Some metaprogramming might fix this. Oh.. except RubyMotion doesn't have define_method. Oh dear... Well there goes that idea.

jamonholmgren commented 9 years ago

We could extend the TableScreen instance with a module, something like this:

module ProMotion::Table::Deletable
  def tableView:commitEditingStyle:forRowAtIndexPath:  # <  i know this is wrong, in a hurry
  end
end

...

screen.extend(PM::Table::Deletable) if @deletable # whatever
austinseraphin commented 9 years ago

Ah yes, much simpler. Yes, include the module if the table has any cells with an editing style of delete or insert.

austinseraphin commented 9 years ago

Please see pull request #678

squidpunch commented 9 years ago

:+1:

markrickert commented 9 years ago

As per #690, including the tableView:commitEditingStyle:forRowAtIndexPath: in a extended module breaks actual deleting functionality. I'm pretty sure that it has to be included in the class when the class is loaded and not included modularly in order for the table cells to actually be deletable.

markrickert commented 9 years ago

Based on https://gist.github.com/d-ronnqvist/3584ccf3379f9c318e4f I think i may have found a valid solution to this. @austinseraphin can you please check out the branch bug/690-edit-table and let me know if this works with accessibility?

austinseraphin commented 9 years ago

Yes this works.

austinseraphin commented 9 years ago

Perhaps unrelated, when I have the editing style set to insert it still says swipe to delete. I don’t know if this happens because of a VoiceOver bug or a bug in ProMotion. I’ll dig a little. But for now the regular cells don’t report any actions, the original point of this bug report.

On May 14, 2015, at 12:28 PM, Mark Rickert notifications@github.com wrote:

Based on https://gist.github.com/d-ronnqvist/3584ccf3379f9c318e4f https://gist.github.com/d-ronnqvist/3584ccf3379f9c318e4f I think i may have found a valid solution to this. @austinseraphin https://github.com/austinseraphin can you please check out the branch bug/690-edit-table and let me know if this works with accessibility?

— Reply to this email directly or view it on GitHub https://github.com/clearsightstudio/ProMotion/issues/653#issuecomment-102094176.