Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

focus on table row ?

4,092 views
Skip to first unread message

rvj

unread,
Nov 15, 2008, 7:14:01 AM11/15/08
to
should it be possible to set focus on a table row?

.... if not is there any other (pseudo) method for setting applying css
to the current row?

ps I know I can use classes but it seems a bit of a hack


Ryan Doherty

unread,
Nov 17, 2008, 12:36:32 PM11/17/08
to dev-te...@lists.mozilla.org
Adding a semantic classname of 'selected' or 'active' to a table row
isn't a hack. It's valid (and meaningful) HTML and CSS.

-Ryan

> _______________________________________________
> dev-tech-css mailing list
> dev-te...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-css

Ryan Doherty
rdoh...@mozilla.com

rvj

unread,
Nov 18, 2008, 7:18:11 AM11/18/08
to

I probably misunderstand your point but given a series of tags such as

<tr>aaaa</tr>
<tr>bbbb</tr>
<tr>cccc</tr>

and some css such as

tr {color:black}
tr:active {color blue}

is there a psuedo class other than active which will will leave the tr
colour blue even after mouse up
but return to black when another row is clicked

but if you mean setting the class attribute via js moveclick event then you
have to remeber which row was clicked previously
so you can reset it - which is why I said its a hack

focus seems the obvious pseudo class but this does nt work for non input
tags


"Ryan Doherty" <rdoh...@mozilla.com> wrote in message
news:mailman.694.12269433...@lists.mozilla.org...

Stanimir Stamenkov

unread,
Nov 23, 2008, 3:56:46 AM11/23/08
to
Tue, 18 Nov 2008 12:18:11 -0000, /rvj/:

> tr {color:black}
> tr:active {color blue}
>
> is there a psuedo class other than active which will will leave the tr
> colour blue even after mouse up
> but return to black when another row is clicked

I guess you'll need the :focus [1] pseudo class, also. I've found
(some info on "Focus and Selection" [2]) if you just define a
'tabindex' on the element it becomes focusable:

tr:focus { color: blue }

<table border="1">
<tbody>
<tr tabindex="0"><td>1</td><td>2</td><td>3</td></tr>
<tr tabindex="0"><td>4</td><td>5</td><td>6</td></tr>
</tbody>
</table>

I guess this could be achieved with -moz-binding without including
invalid attributes in the HTML document, also.

There's a -moz-user-focus [3] CSS property, but it doesn't seem to
automatically trigger the ability to keyboard focus the element.

[1] http://www.w3.org/TR/CSS21/selector.html#dynamic-pseudo-classes
[2] https://developer.mozilla.org/en/XUL_Tutorial/Focus_and_Selection
[3] https://developer.mozilla.org/en/CSS/-moz-user-focus

--
Stanimir

rvj

unread,
Nov 24, 2008, 10:18:32 AM11/24/08
to
thanks for info - it looks just the job!

rvj

"Stanimir Stamenkov" <s7a...@netscape.net> wrote in message
news:gpOdnY61jvlMh7TU...@mozilla.org...

0 new messages