Re: RFR: 8268225: Support :focus-visible and :focus-within CSS pseudoclasses [v7]

2021-12-10 Thread Jeanette Winzenburg
On Tue, 7 Dec 2021 15:44:26 GMT, Michael Strauß  wrote:

>However, I'd still argue that a node that is not part of the scene graph 
>(non-atomically) should not be the focus owner of the scene graph.

I agree :)

But that's what seems to happen: in my example, add a handler to remove the 
focused "moving" button. When removed, the scene's focus owner is either the 
next focusable (the "move" button) or null if there is none. On re-adding the 
button, it's either unfocused (if there had been a next focusable) or focused 
(if there is none). Not sure what happens in your test snippet ..

-

PR: https://git.openjdk.java.net/jfx/pull/475


Re: RFR: 8268225: Support :focus-visible and :focus-within CSS pseudoclasses [v7]

2021-12-07 Thread Jeanette Winzenburg
On Fri, 20 Aug 2021 05:15:49 GMT, Michael Strauß  wrote:

>> This PR adds the `Node.focusVisible` and `Node.focusWithin` properties, as 
>> well as the corresponding `:focus-visible` and `:focus-within` CSS 
>> pseudo-classes.
>
> Michael Strauß has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   fixed undeterministic test failures

thanks for taking a closer look :) 

> > might also need a test that verifies the focusWithin of a parent added 
> > somewhere above the focused node? hmm .. or maybe not, that would require 
> > to re-arrange a complete subtree ..
> 
> Inserting a parent into a scene graph such that the existing subtree at that 
> position becomes a subtree of the newly inserted parent can't be done as an 
> atomic operation. First, you'll need to remove the subtree at the insertion 
> point from the existing scene graph (otherwise you'll get an exception saying 
> that a node can only appear once in a scene graph). Then you can add the new 
> parent with the removed subtree as its child.

yeah that's true, but might happen behind the scenes - we can move a focused 
node from one parent to another by simply adding it the new. 

So I'm not sure I would agree: 

> I'm inclined to think that this behavior is a bug.

arguable, though :) Below is an example of moving a focused node (button 
"Moving", the other is just for having something else that might get the focus) 
between 2 parents by F1: the button keeps its focused state in its new parent 
(and scene's focusOwner doesn't change) - I think that's what a user would 
expect also when dragging a focused node around (s/he might not even be aware 
of the hierarchy). I suspect that changing the behavior would break existing 
applications - except if it could be done completely transparently.

The example:

private Parent createContent() {
first = new VBox();
first.setBackground(new Background(new BackgroundFill(Color.ALICEBLUE, 
null, null)));
first.getChildren().add(new Label("label on first"));
second = new VBox();
second.setBackground(new Background(new BackgroundFill(Color.LAVENDER, 
null, null)));
second.getChildren().add(new Label("label on second"));

moving = new Button("moving");
first.getChildren().add(moving);
Button move = new Button("move");
move.setOnAction(e -> {
move();
});
move.setDefaultButton(true);
HBox content = new HBox(10, first, second, move);
content.addEventFilter(KeyEvent.KEY_PRESSED, e -> {
if (e.getCode() == KeyCode.F1) {
move();
}
});
return content;
}

private void move() {
Parent parent = moving.getParent();
Pane target = parent == first ? second : first;
target.getChildren().add(moving);
}

@Override
public void start(Stage stage) throws Exception {
Scene scene = new Scene(createContent(), 300, 300);
scene.focusOwnerProperty().addListener((scr, ov, nv) -> {
System.out.println("focusOwner: " + nv);
});
stage.setScene(scene);
stage.show();
}

private VBox first;
private VBox second;
private Button moving;

-

PR: https://git.openjdk.java.net/jfx/pull/475


Re: RFR: 8268225: Support :focus-visible and :focus-within CSS pseudoclasses [v7]

2021-12-06 Thread Jeanette Winzenburg
On Fri, 20 Aug 2021 05:15:49 GMT, Michael Strauß  wrote:

>> This PR adds the `Node.focusVisible` and `Node.focusWithin` properties, as 
>> well as the corresponding `:focus-visible` and `:focus-within` CSS 
>> pseudo-classes.
>
> Michael Strauß has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   fixed undeterministic test failures

Just some musings (slightly overwhelmed by the magnitude of the suggested 
change ;) On first look it sounds like this has 2 separated (though related) 
parts:

- focus-visible: that's visual sugar (*ducking)
- focus-within: that might be a game changer (or enhancer) for both internal 
and external usage

>From my current focus - *haha - on cell editing, the latter feels very 
>promising for allowing fine-grained control of defining, implementing and 
>configuring the required, much debated and (until now) unsuccessful tries on 
>"commit-on-focusLost" semantics.

-

PR: https://git.openjdk.java.net/jfx/pull/475


Re: RFR: 8268225: Support :focus-visible and :focus-within CSS pseudoclasses [v7]

2021-11-11 Thread Kevin Rushforth
On Fri, 20 Aug 2021 05:15:49 GMT, Michael Strauß  wrote:

>> This PR adds the `Node.focusVisible` and `Node.focusWithin` properties, as 
>> well as the corresponding `:focus-visible` and `:focus-within` CSS 
>> pseudo-classes.
>
> Michael Strauß has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   fixed undeterministic test failures

@aghaisas and I will review it.

-

PR: https://git.openjdk.java.net/jfx/pull/475


Re: RFR: 8268225: Support :focus-visible and :focus-within CSS pseudoclasses [v7]

2021-11-11 Thread Jeanette Winzenburg
On Wed, 10 Nov 2021 17:45:32 GMT, Michael Strauß  wrote:

> 
> 
> @kleopatra Can you be a reviewer on this PR?

css is not my turf, sry

-

PR: https://git.openjdk.java.net/jfx/pull/475


Re: RFR: 8268225: Support :focus-visible and :focus-within CSS pseudoclasses [v7]

2021-11-10 Thread Michael Strauß
On Thu, 9 Sep 2021 09:51:33 GMT, Jeanette Winzenburg  
wrote:

>>> Just curious: with this in place, would it be possible to use for 
>>> supporting [JDK-8087926](https://bugs.openjdk.java.net/browse/JDK-8087926) 
>>> (it's a bit vague, though, at least for me)?
>> 
>> Yes, `:focus-within` can be used to select an ancestor of the 
>> currently-focused node.
>
>> 
>> 
>> > Just curious: with this in place, would it be possible to use for 
>> > supporting [JDK-8087926](https://bugs.openjdk.java.net/browse/JDK-8087926) 
>> > (it's a bit vague, though, at least for me)?
>> 
>> Yes, `:focus-within` can be used to select an ancestor of the 
>> currently-focused node.
> 
> cool - thanks :)

@kleopatra Can you be a reviewer on this PR?

-

PR: https://git.openjdk.java.net/jfx/pull/475


Re: RFR: 8268225: Support :focus-visible and :focus-within CSS pseudoclasses [v7]

2021-10-05 Thread Michael Strauß
On Fri, 20 Aug 2021 05:15:49 GMT, Michael Strauß  wrote:

>> This PR adds the `Node.focusVisible` and `Node.focusWithin` properties, as 
>> well as the corresponding `:focus-visible` and `:focus-within` CSS 
>> pseudo-classes.
>
> Michael Strauß has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   fixed undeterministic test failures

I've created a [CSR](https://bugs.openjdk.java.net/browse/JDK-8274798) for this 
feature.

-

PR: https://git.openjdk.java.net/jfx/pull/475


Re: RFR: 8268225: Support :focus-visible and :focus-within CSS pseudoclasses [v7]

2021-09-09 Thread Jeanette Winzenburg
On Thu, 9 Sep 2021 09:47:56 GMT, Michael Strauß  wrote:

> 
> 
> > Just curious: with this in place, would it be possible to use for 
> > supporting [JDK-8087926](https://bugs.openjdk.java.net/browse/JDK-8087926) 
> > (it's a bit vague, though, at least for me)?
> 
> Yes, `:focus-within` can be used to select an ancestor of the 
> currently-focused node.

cool - thanks :)

-

PR: https://git.openjdk.java.net/jfx/pull/475


Re: RFR: 8268225: Support :focus-visible and :focus-within CSS pseudoclasses [v7]

2021-09-09 Thread Michael Strauß
On Thu, 9 Sep 2021 09:15:06 GMT, Jeanette Winzenburg  
wrote:

> Just curious: with this in place, would it be possible to use for supporting 
> [JDK-8087926](https://bugs.openjdk.java.net/browse/JDK-8087926) (it's a bit 
> vague, though, at least for me)?

Yes, `:focus-within` can be used to select an ancestor of the currently-focused 
node.

-

PR: https://git.openjdk.java.net/jfx/pull/475


Re: RFR: 8268225: Support :focus-visible and :focus-within CSS pseudoclasses [v7]

2021-09-09 Thread Jeanette Winzenburg
On Fri, 20 Aug 2021 05:15:49 GMT, Michael Strauß  wrote:

>> This PR adds the `Node.focusVisible` and `Node.focusWithin` properties, as 
>> well as the corresponding `:focus-visible` and `:focus-within` CSS 
>> pseudo-classes.
>
> Michael Strauß has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   fixed undeterministic test failures

Just curious: with this in place, would it be possible to use for supporting 
[JDK-8087926](https://bugs.openjdk.java.net/browse/JDK-8087926) (it's a bit 
vague, though, at least for me)?

-

PR: https://git.openjdk.java.net/jfx/pull/475


Re: RFR: 8268225: Support :focus-visible and :focus-within CSS pseudoclasses [v7]

2021-08-19 Thread Michael Strauß
> This PR adds the `Node.focusVisible` and `Node.focusWithin` properties, as 
> well as the corresponding `:focus-visible` and `:focus-within` CSS 
> pseudo-classes.

Michael Strauß has updated the pull request incrementally with one additional 
commit since the last revision:

  fixed undeterministic test failures

-

Changes:
  - all: https://git.openjdk.java.net/jfx/pull/475/files
  - new: https://git.openjdk.java.net/jfx/pull/475/files/a1da00b2..d9a715e3

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jfx&pr=475&range=06
 - incr: https://webrevs.openjdk.java.net/?repo=jfx&pr=475&range=05-06

  Stats: 37 lines in 1 file changed: 35 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jfx/pull/475.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/475/head:pull/475

PR: https://git.openjdk.java.net/jfx/pull/475