JPro-one / jpro-routing

Small web-framework for JPro
https://www.jpro.one
Apache License 2.0
6 stars 0 forks source link

Z Order of LinkUtil.setLink() are not working fine, parent links overrides / hides child link! #11

Open ctoabidmaqbool opened 1 year ago

ctoabidmaqbool commented 1 year ago

If an Parent element e.g. Card has some link, within this Card another element e.g. Button which have different link.

The problem is that, Button link hides upon external link e.g. Card not works rather Card's links works on it.

image

VBox card = new VBox(10);
card.setPrefSize(150, 80);

LinkUtil.setLink(card, "/product1");

Button btnAdd = new Button("Add to cart");

LinkUtil.setLink(btnAdd, "/add-to-cart");

card.getChildren().add(btnAdd);

Expected behavior should be both links should works.

See for example this code:

VBox card = new VBox(10);
card.setPrefSize(150, 80);

// LinkUtil.setLink(card, "/product1");
card.setOnMouseClicked(event -> {
     LinkUtil.gotoPage(card, "/product1");
});

Button btnAdd = new Button("Add to cart");

// LinkUtil.setLink(btnAdd, "/add-to-cart");
btnAdd.setOnAction(event -> {
     LinkUtil.gotoPage(btnAdd, "/add-to-cart");
});

card.getChildren().add(btnAdd);
ctoabidmaqbool commented 1 year ago

Any solution yet? As LinkUtil.gotoPage() have some issues.

  1. When hover on the link, URL not shows in browser status bar (bottom left or right)
  2. Have to do extra works e.g. set Hand cursor or stillSincePress
  3. Have to set extra codding every time, first set click or action listener then set gotoPage etc
FlorianKirmaier commented 1 year ago

@ctoabidmaqbool Thank you for the bug report. Unfortunately, the solution is not trivial. Currently, the routing adds an invisible div-link into the dom. The solution would probably be to add the link directly to the element in the html-dom.