Closed Bug 310241 Opened 19 years ago Closed 18 years ago

InvisionBoard AJAX/JS facility for quoting text no longer works

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.8.1beta2

People

(Reporter: jjhanna, Assigned: MatsPalmgren_bugz)

References

()

Details

(Keywords: fixed1.8.1, regression, testcase)

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b5) Gecko/20050927 Firefox/1.4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b5) Gecko/20050927 Firefox/1.4

A little bit of InvisionBoard AJAX/JS that used to work with 1.5 but now doesn't
work. It does still work with 1.07, Opera 8.5 and IE.
If you goto http://www.wow-factor.com/forums/index.php?showtopic=6197 scroll to
the bottom of the page you will see the Quick Reply box.
Highlight some text from a previous post and then hover your mouse back over the
Quick Reply box and you will get an option appearing to "Add Selected Text as Quote"

It doesn't add the text anymore.

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b5) Gecko/20050927 Firefox/1.4

Reproducible: Always

Steps to Reproduce:
1.goto http://www.wow-factor.com/forums/index.php?showtopic=6197
2.scroll to the bottom of the page you will see the Quick Reply box.
3.Highlight some text from a previous post
4.hover your mouse back over the Quick Reply box
5.you will get an option appearing to "Add Selected Text as Quote"
6.It doesn't add the text anymore.

Actual Results:  
Step 6. It doesn't add the text anymore.

Expected Results:  
Placed the highlighted text from the previous post into the textarea as a QUOTE

This worked in 1.5 Beta 1 but failed after ( what I believe ) the UPDATE to
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b5) Gecko/20050927 Firefox/1.4

Note: It works fine in Firefox 1.07, Opera 8.5 and IE 6
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b5) Gecko/20050927
Firefox/1.4 ID:2005092714

Confirmed->NEW
?1.8b5

I'll check the regression date/time tomorrow.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: blocking1.8b5?
Keywords: regression
*** Bug 310239 has been marked as a duplicate of this bug. ***
John, are you sure this ever worked ?
I tried builds back till before 1.5b1 (20050906 0739pdt) and none of them seem
to work.
Nothing in JSC / Errorconsole either.

Can you try some builds to figure it out ?

In reply to Peter Re builds
Peter this works as it should in FF 1.07 and I must apologise for not knowing
about earlier nightly builds as I just converted my 1.5 Beta 1 to nightly
updates a couple of days ago.
I am sure this function worked in 1.5 Beta 1

Cheers
John
Attached file Simplified testcase
Just posted at Invisionboard and had this tested by users
They report that it doesn't work with 1.5 Beta 1 either.
John
I've tried the simplified testcase (Comment #5) back to 2005030107 (Trunk
nightly of March 1, 2005) with no success. Will try going back further later.
I believe I've found the cause for this. In 1.0.7, the text remains selected
when clicking on the button in the testcase. In the latest nightly builds the
text gets deselected (and thus window.getSelection() returns nothing), which I
believe is intended behaviour (although I can't find the bug number). Mark this
bug invalid?
There is a test case here that goes more in depth.
https://bugzilla.mozilla.org/show_bug.cgi?id=120776

INPUT type=button doesn't seem to work,
but <button> does.
focus also seems to be lost when clicking on text links, but not on images.
Is this bug Firefox specific or does it need to be moved somewhere more appropriate?
This regressed between 2004-11-28 and 2004-12-02, possibly a change in behavior
from bug 269318?
For me, current behavior seems more logical to me, though.
Assignee: nobody → events
Component: General → Event Handling
Keywords: testcase
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → Trunk
(In reply to comment #11)
> This regressed between 2004-11-28 and 2004-12-02, possibly a change in behavior
> from bug 269318?
> For me, current behavior seems more logical to me, though.

(In reply to comment #10)
> Is this bug Firefox specific or does it need to be moved somewhere more
appropriate?

Well, it's not a bug in 1.07, Mozilla or any other modern browser, simply in the
version of 1.5 as detailed in the original post.
Aaron, can you look into this. Seems like a regression from your changes.
Assignee: events → aaronleventhal
I don't see the "quick reply" box in the bottom of that page, so I am using the
"simplified testcase"

> it's not a bug in 1.07, Mozilla or any other modern browser, simply in the
> version of 1.5 as detailed in the original post.

What other browser does this test case work in? I can't get it to work in either
IE or Opera.

> What other browser does this test case work in? I can't get it to work in either
IE or Opera.

The testcase uses window.getSelection() only. This is a Mozilla only feature
(AFAIK). The actual InvisionBoard script checks whether window.getSelection()
exists, and if not uses either document.selection or document.getSelection().
(In reply to comment #15)
> > What other browser does this test case work in? I can't get it to work in either
> IE or Opera.
> 
> The testcase uses window.getSelection() only. This is a Mozilla only feature
> (AFAIK). The actual InvisionBoard script checks whether window.getSelection()
> exists, and if not uses either document.selection or document.getSelection().

Here is the IPB JS that covers this ( I think )
/*--------------------------------------------*/
// check selection
/*--------------------------------------------*/

function checkselection()
{
	var myselection = '';
	
	if ( window.getSelection )
	{
		myselection = window.getSelection();
	}
	else if ( document.selection )
	{
		myselection = document.selection.createRange().text;
	}
	else if ( document.getSelection )
	{
		myselection = document.getSelection();
	}
	
	if ( myselection != '' && myselection != null )
	{
		if ( myselection != mystored_selection )
		{
			document.getElementById('fastreply-pastesel').style.display = '';
			mystored_selection = myselection;
		}
	}
}

/*--------------------------------------------*/
// Paste selection
/*--------------------------------------------*/

function pasteselection()
{
	if ( mystored_selection != '' && mystored_selection != null )
	{
		document.getElementById('fastreplyarea').value +=
'[quote]'+mystored_selection+'[/quote]\n';
		//document.getElementById('fastreply-pastesel').style.display = 'none';
	}
}
/*============================*/

and the related  html...

<textarea onmouseover='checkselection()' id='fastreplyarea' cols="70" rows="8"
name="Post" class="textarea" tabindex="1"></textarea>
		<!-- HIDDEN PASTE SELECTION QUESTION --> 
		<div id='fastreply-pastesel' align='center' style='display:none;'>
		   <input type="button" name="pastesel" onclick="pasteselection();" value="Add
Selected Text As Quote" class="button" />
		</div>
		<!-- / HIDDEN PASTE SELECTION QUESTION -->


The changes that caused this are pretty baked in now, and I don't want to back
them out. It will cause other important fixes to regress. The way to fix this is
in nsEventStateManager, but I'm not sure a low risk fix can be made for Firefox 1.5.

As a workaround can you try grabbing selection in an onblur handler and storing
it for use in your script?

I realize a workaround is probably not what you want but please understand I'm
looking at this bug late in the cycle, and we've had a lot of problems getting
focus to the point where it is now.
bryner and johnny, this looks like something we want to fix. Can you help us
look into this? I'm scared of taking focus changes so late in the game but this
is a regression and may be widespread. 
Comment on attachment 198003 [details] [diff] [review]
Use mLastFocusedWith as we used to, to determine whether or not to tab from focus or selection

Looks good to me. With this patch we don't reset the selection
when right-clicking on a link, even when outside the selection -
personally I like that behaviour and the question of what to
show in the context menu is a separate issue (bug 135813).
r=mats
Attachment #198003 - Flags: review?(mats.palmgren) → review+
Attachment #198003 - Flags: superreview?(bryner)
not a beta blocker. we'd consider a fully reviewed patch for approval if you all
can make the case that we're not taking on significant risk with this approach.
Flags: blocking1.8b5? → blocking1.8b5-
(In reply to comment #14)
> I don't see the "quick reply" box in the bottom of that page, so I am using the
> "simplified testcase"

click fastREPLY button, then the box is show!
Attachment #198003 - Flags: superreview?(bryner) → superreview+
Fixed on trunk.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Not fixed at Firefox 1.5 final.
(In reply to comment #24)
> Not fixed at Firefox 1.5 final.

That's because the patch hasn't been checked into the MOZILLA_1_8_BRANCH.

Flags: blocking1.8.0.1?
(In reply to comment #25)
> (In reply to comment #24)
> > Not fixed at Firefox 1.5 final.
> 
> That's because the patch hasn't been checked into the MOZILLA_1_8_BRANCH.
> 

It was considered too risky.
Flags: blocking1.8.0.2?
Flags: blocking1.8.0.1?
Flags: blocking1.8.0.1-
denied for 1.8.0.2, the risk/benefit ratio hasn't changed
Flags: blocking1.8.0.2? → blocking1.8.0.2-
*** Bug 317914 has been marked as a duplicate of this bug. ***
*** Bug 332131 has been marked as a duplicate of this bug. ***
Flags: blocking1.8.1?
Flags: blocking1.8.1? → blocking1.8.1+
Comment on attachment 198003 [details] [diff] [review]
Use mLastFocusedWith as we used to, to determine whether or not to tab from focus or selection

please land this on the 1.8 branch and add the fixed1.8.1 keyword.
Attachment #198003 - Flags: approval-branch-1.8.1+
Whiteboard: [checkin needed]
Whiteboard: [checkin needed] → [checkin needed (1.8 branch)]
Target Milestone: --- → mozilla1.8.1beta1
Please land this on the 1.8 branch ASAP so this does not hold up the FF2 beta1 release.  Thanks!
Moving to Beta2 and clearing approval flag.  We'll pick this up after beta1.  Aaron can you land once the tree re-opens.
Target Milestone: mozilla1.8.1beta1 → mozilla1.8.1beta2
Attachment #198003 - Flags: approval-branch-1.8.1+
Actually I would strongly prefer that Mats Palmgren land this since he owns focus code now, and was a reviewer of the patch. I'm not prepared to deal with regressions from this, or any other focus/keynav issues moving forward.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee: aaronleventhal → mats.palmgren
Status: REOPENED → NEW
Status: NEW → RESOLVED
Closed: 19 years ago18 years ago
Resolution: --- → FIXED
Whiteboard: [checkin needed (1.8 branch)]
Attachment #198003 - Flags: approval1.8.1?
Comment on attachment 198003 [details] [diff] [review]
Use mLastFocusedWith as we used to, to determine whether or not to tab from focus or selection

a=drivers, mats, please land this on the branch
Attachment #198003 - Flags: approval1.8.1? → approval1.8.1+
Checked in on MOZILLA_1_8_BRANCH at 2006-07-19 13:41 PDT:
content/events/src/nsEventStateManager.h     1.137.4.4
content/events/src/nsEventStateManager.cpp   1.595.2.22
Keywords: fixed1.8.1
Depends on: 357524
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: