WebAIM - Web Accessibility In Mind

E-mail List Archives

Thread: Use of SAMP to highlight search results

for

Number of posts in this thread: 4 (In chronological order)

From: Pete Fairhurst
Date: Thu, Oct 28 2010 4:06AM
Subject: Use of SAMP to highlight search results
No previous message | Next message →

Hi everyone,

I'm Pete Fairhurst, a web developer with 11 years' experience based in
Bristol, England.

I was wondering what people think of my idea to use the SAMP element to
highlight matching text in a list of search results?

http://www.htmlcodetutorial.com/_SAMP.html

On the face of it, SAMP sounds like it might be a better element to use than
EM, which is how I currently highlight matching text in search results.

What do you think? Does this sound like a good alternative, or should I be
using a different element entirely to EM or SAMP?

Thanks in advance!

- Pete

~~~~

"Haste in art is almost always vulgarisation." H.G. Wells

From: Cliff Tyllick
Date: Thu, Oct 28 2010 9:24AM
Subject: Re: Use of SAMP to highlight search results
← Previous message | Next message →

I hadn't thought of this before, Pete.

According to the draft html5 spec, <samp> is to be used to tag program output in the middle of other content. For example, this might be an appropriate use:

"Returning <samp>404 Error: Page not found</samp> is not only unhelpful but also rude."

If you want to mark search terms used, the closer fit would be <kbd>, which the spec says is for tagging text as terms input by the user. And the user entered the search terms, right?

Just my quick thought. Someone else might have a still better idea.

Cliff

Cliff Tyllick
Usability assessment coordinator
Agency Communications Division
Texas Commission on Environmental Quality
512-239-4516
= EMAIL ADDRESS REMOVED =


>>> On 10/28/2010 at 5:04 AM, in message <AANLkTi=Zj3_x4VUaw=T85SU+t= = EMAIL ADDRESS REMOVED = >, Pete Fairhurst < = EMAIL ADDRESS REMOVED = > wrote:
Hi everyone,

I'm Pete Fairhurst, a web developer with 11 years' experience based in
Bristol, England.

I was wondering what people think of my idea to use the SAMP element to
highlight matching text in a list of search results?

http://www.htmlcodetutorial.com/_SAMP.html

On the face of it, SAMP sounds like it might be a better element to use than
EM, which is how I currently highlight matching text in search results.

What do you think? Does this sound like a good alternative, or should I be
using a different element entirely to EM or SAMP?

Thanks in advance!

- Pete

~~~~

"Haste in art is almost always vulgarisation." H.G. Wells

From: Patrick H. Lauke
Date: Thu, Oct 28 2010 9:33AM
Subject: Re: Use of SAMP to highlight search results
← Previous message | Next message →

I'd say the "mark" element sounds more appropriate

http://www.w3.org/TR/html5/text-level-semantics.html#the-mark-element

On 28/10/2010 11:04, Pete Fairhurst wrote:
> Hi everyone,
>
> I'm Pete Fairhurst, a web developer with 11 years' experience based in
> Bristol, England.
>
> I was wondering what people think of my idea to use the SAMP element to
> highlight matching text in a list of search results?
>
> http://www.htmlcodetutorial.com/_SAMP.html
>
> On the face of it, SAMP sounds like it might be a better element to use than
> EM, which is how I currently highlight matching text in search results.
>
> What do you think? Does this sound like a good alternative, or should I be
> using a different element entirely to EM or SAMP?
>
> Thanks in advance!
>
> - Pete
>
> ~~~~
>
> "Haste in art is almost always vulgarisation." H.G. Wells
>

From: Jukka K. Korpela
Date: Thu, Oct 28 2010 1:18PM
Subject: Re: Use of SAMP to highlight search results
← Previous message | No next message

Patrick H. Lauke wrote:

> I'd say the "mark" element sounds more appropriate

Within HTML5, yes. But HTML5 is an incomplete draft, or set of drafts,
expected to be finalized maybe around year 2020. Moreover, the MARK element
does not imply any particular rendering or other processing, in the browsers
that recognize it. It's a bad idea, if you ask me, to define an element for
a certain kind of emphasis without saying that it should be rendered
emphatically - the idea seems to be that authors will style it, naturally
routinely ignoring non-visual browsing, among other things.

But enough of this - MARK surely would not improve usability.

The way to emphasize text in a manner that maximizes the odds of making
different browsers highlight it somehow is to use the STRONG element.

The OP wrote:

>> On the face of it, SAMP sounds like it might be a better element to
>> use than EM, which is how I currently highlight matching text in
>> search results.

Using EM is not a good practical choice, since in practice it means italic
text in most browsers, and most pages use some sans-serif font. In such
fonts, italic text is not particularly highlighted - it differs too little
from normal text. So I would use STRONG, which is normally rendered in bold,
and I might throw in some style sheet that uses e.g. yellow background for
STRONG, e.g.
strong { background: #ffd; color: black; padding: 0 0.05em; }

>> What do you think? Does this sound like a good alternative, or
>> should I be using a different element entirely to EM or SAMP?

The SAMP element is rarely used on web pages, and it's not particularly
useful. It is meant to be used for computer output, though some early
interpretations say that it could also be used for "sample texts", like
words presented as objects of discussion rather than used normally. Browsers
generally render SAMP in monospace font by default. Some translation
software treats SAMP as indicating that its content is to be treated
literally, invariant in translation. So SAMP is mostly an oddity.

--
Yucca, http://www.cs.tut.fi/~jkorpela/