# \[Bug\] layer.moveAbove group

**URL:** <https://forums.creativeclouddeveloper.com/t/bug-layer-moveabove-group/8068>\
**Category:** Photoshop\
**Created:** [June 28, 2024, 3:58pm UTC](https://forums.creativeclouddeveloper.com/t/bug-layer-moveabove-group/8068 "2024-06-28T15:58:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Liryk](https://avatars.discourse-cdn.com/v4/letter/l/9dc877/32.png) [@Liryk](https://forums.creativeclouddeveloper.com/u/Liryk)\
**Post date:** [June 28, 2024, 3:58pm UTC](https://forums.creativeclouddeveloper.com/t/bug-layer-moveabove-group/8068/1 "2024-06-28T15:58:24Z")

</div>

Hi, I use [moveAbove](https://developer.adobe.com/photoshop/uxp/2021/ps_reference/classes/layer/#moveabove) method to place a layer above another layer.  
But I’ve faced a case when this method doesn’t work as expected.  
If I try to move the layer which is located on top of the hierarchy above the group which is located inside the other group. Layer will be moved inside group, not above it.  
I’ve created a minimal sample to reproduce this issue:  
On the screenshot you can see layer with name **LayerToMove** which I want to move above the **ActualLocation** group.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/xdplugins/original/2X/7/744e1d6ae8bffed6c78002c19123ec945f32c4e1.png)  
To move the layer, I use the following simple code:

```auto
const app = require('photoshop').app;
const {executeAsModal} = require("photoshop").core;
executeAsModal(() => app.activeDocument.layers[0].moveAbove(app.activeDocument.layers[1].layers[0]), {})

```

But after executing the code, the layer moves inside the **ActualLocation** group, not above it.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/xdplugins/original/2X/e/e9be98001ad617aa86cc7fd25cf0afedae5a1850.png)  
Looks like a bug, or am I doing something wrong?  
This issue reproduces only if moving layer is located on top of the hierarchy, in other cases **moveAbove** works as expected.

---

<div class="post-metadata">

**Author:** ![JasonM](https://avatars.discourse-cdn.com/v4/letter/j/3be4f8/32.png) [@JasonM](https://forums.creativeclouddeveloper.com/u/JasonM)\
**Post date:** [June 28, 2024, 8:09pm UTC](https://forums.creativeclouddeveloper.com/t/bug-layer-moveabove-group/8068/2 "2024-06-28T20:09:20Z")

</div>

What happens if instead of defining the layer to move above like you are doing, you use the selected layer?

> [@Liryk](#):
>
> `moveAbove(app.activeDocument.layers[1].layers[0])`

---

<div class="post-metadata">

**Author:** ![Liryk](https://avatars.discourse-cdn.com/v4/letter/l/9dc877/32.png) [@Liryk](https://forums.creativeclouddeveloper.com/u/Liryk)\
**Post date:** [July 1, 2024, 9:21am UTC](https://forums.creativeclouddeveloper.com/t/bug-layer-moveabove-group/8068/3 "2024-07-01T09:21:01Z")

</div>

Same issue if I am doing like this:

```auto
app.activeDocument.activeLayers[0].moveAbove(app.activeDocument.layers[1].layers[0])

```
