Script button to delete folder selected in tree

If folder in tree is selected, script below does nothing.
But if file is selected in folder but focus is on tree, script below try to delete file instead of folder.
Normal or not ?

Function OnClick(ByRef clickData)
	If clickData.func.command.IsSet("FOCUS=tree") Then
		clickData.func.command.RunCommand "Delete"
	End If
End Function

Use this if you want the script to delete the current folder of the tab it is run from when the tree has focus:

Function OnClick(ByRef clickData)
	Set cmd = clickData.func.command
	If cmd.IsSet("FOCUS=tree") Then
		cmd.ClearFiles
		cmd.AddFile clickData.func.sourcetab.path
		cmd.RunCommand "Delete"
	End If
End Function