Context menu or Action buttons ?

Recently I was drawn into one of those UI “religious” disputes that has no easy answers and usually both sides are right. One of our web developers was trying out new web tech (with pretty rich widget library) and started to question himself about some basic usability decisions. The low level problem in this case is usually brought to “which widget should I use ?”. I’m not fond of bringing the usability problems to questions: Should I use Tabs over Menu ? Or should I use Context menu instead of buttons panel ? But sometimes if time is crucial factor and other usability levels are by default not addressed at all – better developer that asks those basic questions than developer that do not question himself at all.

Recently I was drawn into one of those UI “religious” disputes that has no easy answers and usually both sides are right. One of our web developers was trying out new web tech (with pretty rich widget library) and started to question himself about some basic usability decisions. The low level problem in this case is usually brought to “which widget should I use ?”. I’m not fond of bringing the usability problems to questions: Should I use Tabs over Menu ? Or should I use Context menu instead of buttons panel ? But sometimes if time is crucial factor and other usability levels are by default not addressed at all – better developer that asks those basic questions than developer that do not question himself at all. One of often “problematic” choice that is bring up by web developers is should user launch actions on selected objects (one of many or some of many) by “Context menu” or “Action buttons”. Basic example is shown below and it is usually a table or list of components that has some defined actions (i.e. on table where rows are single orders change status of selected order would be on of possible actions). Of course there are many other solutions that can be implemented (some actions can be handled directly in table row or cell) but narrowing choice to those two was subject of mentioned discussion. During those hot and fast discussions I wasn’t able to point out pros and cons of both solution that’s why I decided to grab them all in this one short post. I hope it will be helpful for same lone developers that thirstily look for best practise or choice while the answer is usually much contextual…

Action button panel

example_view_1

(plus) Pros

  • Clear indication of where and how many actions you can apply to selected row (or other selected object)
  • If action panel is visible all the time theme has expectable behaviour (at least if you are consistent at where you position your action panel)
  • Accessible solution on most mediums (mouse, touch screens, other pointing devices), panel can be bookmarked to be heard on reading devices
  • Action panel can be combined with Details panel (if there is enough space)
  • Actions can be described very precisely

(minus) Cons

  • Space consumption, even if some actions can be hidden under “Advanced” button, this design is always more “stuffed”
  • Can generate (sometimes really long) extra mouse moves and additional clicks
  • Keyboard support may be difficult if rows or selected widgets also use navigations buttons (tab key, arrows etc.)

Context menu

{#Test-Contextmenu}

example_view_2

(plus) Pros

  • If you stick to short action names space consumption is minimal and since it’s used only during action selection it’s also less perceptible
  • Much faster if you use mouse or keyboard (with context menu shortcut / button)
  • Actions can be organised in tree like hierarchy which can be navigated (expanded) with minimal mouse moves and no additional mouse clicks
  • Nicely combines with drag&drop or multi record actions

(minus) Cons

  • Since context menu is invisible until explicitly called some people may not be aware that there are any actions available on selected objects
  • Poor support on some touch pads or touch screens, problematic support on screen readers
  • If used in web applications it overrides default browser context menu which can be a nuisance for some users

Why not both ?

{#Test-Whynotboth%3F}

example_view_3

(plus) Pros

  • Beginners has clear indication of where and what actions are available on selected objects
  • Advanced users can use faster context menu approach, that do not confuse beginners (they still has their action buttons)
  • Action buttons panel can be compressed to minimum, only to show most important actions (other actions can be hidden under “Advanced” button)
  • Action panel can be combined with Details panel, since action buttons would be minimal, there should be more space for details
  • Hide action panel option if workspace size is crucial (i.e. some clients has limited screen size) and users are aware of context menu

(minus) Cons

  • Initially you still loose some fix space
  • Redundancy may be confusing for some users (although this con is questionable – unaware beginners do not see any redundancy, advanced users can hide action panel if it REALLY bothers them)

Summary Choice between Context menu or Action buttons panel is pretty contextual and “right” choice strongly depends on supported media and user group. However there is pretty good “mix” solution that gives more pros than cons (unless redundancy is big problem for you) and will satisfy unaware beginners and users that strives for fast actions. If you come to mentioned choice, always give a chance to “why not both ?” scenario.

You May Also Like

Inconsistent Dependency Injection to domains with Grails

I've encountered strange behavior with a domain class in my project: services that should be injected were null. I've became suspicious as why is that? Services are injected properly in other domain classes so why this one is different?

Constructors experiment

I've created an experiment. I've created empty LibraryService that should be injected and Book domain class like this:

class Book {
def libraryService

String author
String title
int pageCount

Book() {
println("Finished constructor Book()")
}

Book(String author) {
this()
this.@author = author
println("Finished constructor Book(String author)")
}

Book(String author, String title) {
super()
this.@author = author
this.@title = title
println("Finished constructor Book(String author, String title)")
}

Book(String author, String title, int pageCount) {
this.@author = author
this.@title = title
this.@pageCount = pageCount
println("Finished constructor Book(String author, String title, int pageCount)")
}

void logInjectedService() {
println(" Service libraryService is injected? -> $libraryService")
}
}
class LibraryService {
def serviceMethod() {
}
}

Book has 4 explicit constructors. I want to check which constructor is injecting dependecies. This is my method that constructs Book objects and I called it in controller:

class BookController {
def index() {
constructAndExamineBooks()
}

static constructAndExamineBooks() {
println("Started constructAndExamineBooks")
Book book1 = new Book().logInjectedService()
Book book2 = new Book("foo").logInjectedService()
Book book3 = new Book("foo", 'bar').logInjectedService()
Book book4 = new Book("foo", 'bar', 100).logInjectedService()
Book book5 = new Book(author: "foo", title: 'bar')
println("Finished constructor Book(Map params)")
book5.logInjectedService()
}
}

Analysis

Output looks like this:

Started constructAndExamineBooks
Finished constructor Book()
Service libraryService is injected? -> eu.spoonman.refaktor.LibraryService@2affcce2
Finished constructor Book()
Finished constructor Book(String author)
Service libraryService is injected? -> eu.spoonman.refaktor.LibraryService@2affcce2
Finished constructor Book(String author, String title)
Service libraryService is injected? -> null
Finished constructor Book(String author, String title, int pageCount)
Service libraryService is injected? -> null
Finished constructor Book()
Finished constructor Book(Map params)
Service libraryService is injected? -> eu.spoonman.refaktor.LibraryService@2affcce2

What do we see?

  1. Empty constructor injects dependencies.
  2. Constructor that invokes empty constructor explicitly injects dependencies.
  3. Constructor that invokes parent's constructor explicitly does not inject dependencies.
  4. Constructor without any explicit call declared does not call empty constructor thus it does not inject dependencies.
  5. Constructor provied by Grails with a map as a parameter invokes empty constructor and injects dependencies.

Conclusion

Always explicitily invoke empty constructor in your Grail domain classes to ensure Dependency Injection! I didn't know until today either!

Writing JAXB in Groovy

Suppose you want write a jaxb class in groovy. Why? Because you do not have to write these all getters, setters and other methods. You only have to write your fields down.@XmlRootElement@HashCodeAndEquals@ToStringclass Person { String firstName String ...

[:en] Operational problems with Zookeeper

This post is a summary of what has been presented by Kathleen Ting on StrangeLoop conference. You can watch the original here: http://www.infoq.com/presentations/Misconfiguration-ZooKeeper I've decided to put this selection here for quick reference. ...This post is a summary of what has been presented by Kathleen Ting on StrangeLoop conference. You can watch the original here: http://www.infoq.com/presentations/Misconfiguration-ZooKeeper I've decided to put this selection here for quick reference. ...