Topic: [bug] pun_bbcode tabindex attribute

It's not a "strict" standard by w3c.

That will be all.

Re: [bug] pun_bbcode tabindex attribute

Thanks, we've changed the tabindexes for BBCode-links: [905]

Re: [bug] pun_bbcode tabindex attribute

bump, still doesn't apply for bbcode buttons, because they are outputted differently from smilies. Negative values of tabindex are totally ok, just that you can't use them in images, but you can use them in links.

Re: [bug] pun_bbcode tabindex attribute

I removed those lines (tabindexes) and it passes the w3c validation.

5 (edited by ingram 2009-01-18 10:16)

Re: [bug] pun_bbcode tabindex attribute

Removing isn't the solution, it's the way how to implement the buttons.
bbcodes are right now images with functions of clicking on them, but smilies are link-wrapped images. Tabindex works only on elements which you can use tab between (forms, links etc..). Images are not the case:

My PHP skills are pretty novice, so it might need some cleaning.

what i did, was that i removed the case of  bbcode buttons having the same endings (images versus form input buttons), so i don't know how will normal buttons do, but images did fine. Also my firefox html validator plugin wasn't very happy with the empty ':D','' at smilies, didn't change this though, but w3 validator doesn't whine anymore.

bar.php:

<?php

/***********************************************************************

    Copyright (C) 2008  PunBB

    Based on Easy BBCode extension by Rickard Andersson.

    PunBB is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published
    by the Free Software Foundation; either version 2 of the License,
    or (at your option) any later version.

    PunBB is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
    MA  02111-1307  USA

***********************************************************************/

if (!defined('FORUM'))
    die();

// NOTE: I couldn't find how to remove sf-set from here.
?>    <div class="sf-set" id="pun_bbcode_bar">
        <div id="pun_bbcode_wrapper"<?php echo $forum_user['pun_bbcode_use_buttons']?' class="graphical"':'' ?>>
            <div id="pun_bbcode_buttons">
<?php

// List of tags, which may have attribute
$tags_without_attr = array('b', 'i', 'u', 'url', 'email', 'img', 'list', 'li' => '*', 'quote', 'code');

// List of tags, which may not to have attribute
if ($forum_user['pun_bbcode_use_buttons'])
    $tags_with_attr = array('color');
else
    $tags_with_attr = array('quote', 'color', 'url', 'email', 'img', 'list');

// Let's get the list of all tags
$tags = array_unique(array_merge($tags_without_attr, $tags_with_attr));

if ($forum_user['pun_bbcode_use_buttons'])
{
    if (file_exists($ext_info['path'].'/buttons/'.$forum_user['style'].'/'))
        $buttons_path = $ext_info['url'].'/buttons/'.$forum_user['style'];
    else
        $buttons_path = $ext_info['url'].'/buttons/Oxygen';
}
$tabindex = 1;

foreach ($tags as $filename => $tag)
{
    if (in_array($tag, $tags_without_attr))
    {
        if ($forum_user['pun_bbcode_use_buttons'])
            echo '<a href="javascript:insert_text(\'['.$tag.']\',\'[/'.$tag.']\');" tabindex="'.$tabindex.'"><img src="'.$buttons_path.'/'.(is_numeric($filename)?$tag:$filename).'.png" alt="['.$tag.']" title="'.$tag.'" /></a>'."\n";
        else
            echo '<input type="button" value="'.ucfirst($tag).'" name="'.$tag.'" onclick="insert_text(\'['.$tag.']\',\'[/'.$tag.']\');" tabindex="'.$tabindex.'" />'."\n";
    }

    if (in_array($tag, $tags_with_attr))
    {
        if ($forum_user['pun_bbcode_use_buttons'])
            echo '<a href="javascript:insert_text(\'['.$tag.'=]\',\'[/'.$tag.']\');" tabindex="'.$tabindex.'"><img src="'.$buttons_path.'/'.(is_numeric($filename)?$tag:$filename).'.png" alt="['.$tag.'=]" title="'.$tag.'" /></a>'."\n";
        else
            echo '<input type="button" value="'.ucfirst($tag).'=" name="'.$tag.'" onclick="insert_text(\'['.$tag.'=]\',\'[/'.$tag.']\');" tabindex="'.$tabindex.'" />'."\n";
    }

    $tabindex++;
}

?>
            </div>
            <div id="pun_bbcode_smilies">
<?php

// Display the smiley set
foreach (array_unique($smilies) as $smile_text => $smile_file)
    echo '<a href="javascript:insert_text(\''.$smile_text.'\', \'\');" tabindex="'.($tabindex++).'"><img src="'.$base_url.'/img/smilies/'.$smile_file.'" width="15" height="15" alt="'.$smile_text.'" /></a>'."\n";

?>            </div>
        </div>
    </div>

6 (edited by bingiman 2009-01-18 10:48)

Re: [bug] pun_bbcode tabindex attribute

Cool, but you would still need to change this:

    echo '<a href="javascript:insert_text(\''.$smile_text.'\', \'\');" tabindex="'.($tabindex++).'"><img src="'.$base_url.'/img/smilies/'.$smile_file.'" width="15" height="15" alt="'.$smile_text.'" /></a>'."\n";

to:

        echo '<a onclick="insert_text(\''.$smile_text.'\', \'\');" tabindex="'.($tabindex++).'"><img src="'.$base_url.'/img/smilies/'.$smile_file.'" title="'.$smile_text.'" alt="'.$smile_text.'" /></a>'."\n";

To be validated.
Bingiman

Re: [bug] pun_bbcode tabindex attribute

no offence but tabindex should be removed from punBB completely and utterly - including from any extensions.

tabindex can severely mess things up unless they are implemented correctly, Even when implemented correctly they can be a PITA.

my mind is on a permanent tangent
byUsers forum